Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56ec16cb authored by Alexey Khoroshilov's avatar Alexey Khoroshilov Committed by Mike Snitzer
Browse files

dm log userspace: fix memory leak in dm_ulog_tfr_init failure path



If cn_add_callback() fails in dm_ulog_tfr_init(), it does not
deallocate prealloced memory but calls cn_del_callback().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
Reviewed-by: default avatarJonathan Brassow <jbrassow@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org
parent 0e825862
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -272,7 +272,7 @@ int dm_ulog_tfr_init(void)


	r = cn_add_callback(&ulog_cn_id, "dmlogusr", cn_ulog_callback);
	r = cn_add_callback(&ulog_cn_id, "dmlogusr", cn_ulog_callback);
	if (r) {
	if (r) {
		cn_del_callback(&ulog_cn_id);
		kfree(prealloced_cn_msg);
		return r;
		return r;
	}
	}