summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Khoroshilov <khoroshilov@ispras.ru>2014-10-01 22:58:35 +0200
committerMike Snitzer <snitzer@redhat.com>2014-10-05 20:03:38 -0400
commit56ec16cb1e1ce46354de8511eef962a417c32c92 (patch)
treebdc75b4c2fc10dd0087fdf05b47739902acf52f2
parent0e825862f3c04cee40e25f55680333728a4ffa9b (diff)
downloadlwn-56ec16cb1e1ce46354de8511eef962a417c32c92.tar.gz
lwn-56ec16cb1e1ce46354de8511eef962a417c32c92.zip
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: Alexey Khoroshilov <khoroshilov@ispras.ru> Reviewed-by: Jonathan Brassow <jbrassow@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Cc: stable@vger.kernel.org
-rw-r--r--drivers/md/dm-log-userspace-transfer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/dm-log-userspace-transfer.c b/drivers/md/dm-log-userspace-transfer.c
index b428c0ae63d5..39ad9664d397 100644
--- a/drivers/md/dm-log-userspace-transfer.c
+++ b/drivers/md/dm-log-userspace-transfer.c
@@ -272,7 +272,7 @@ int dm_ulog_tfr_init(void)
r = cn_add_callback(&ulog_cn_id, "dmlogusr", cn_ulog_callback);
if (r) {
- cn_del_callback(&ulog_cn_id);
+ kfree(prealloced_cn_msg);
return r;
}