[ldv-project] Fwd: [PATCH] dm-log-userspace: fix memory leak on failure path in dm_ulog_tfr_init()
Alexey Khoroshilov
khoroshilov at ispras.ru
Thu Oct 2 01:05:36 MSK 2014
-------- Forwarded Message --------
Subject: [PATCH] dm-log-userspace: fix memory leak on failure path in
dm_ulog_tfr_init()
Date: Wed, 1 Oct 2014 22:58:35 +0200
From: Alexey Khoroshilov <khoroshilov at ispras.ru>
To: Alasdair Kergon <agk at redhat.com>, Mike Snitzer <snitzer at redhat.com>
CC: Alexey Khoroshilov <khoroshilov at ispras.ru>, dm-devel at redhat.com,
Neil Brown <neilb at suse.de>, linux-raid at vger.kernel.org,
linux-kernel at vger.kernel.org, ldv-project at linuxtesting.org
If cn_add_callback() fails in dm_ulog_tfr_init(), it does not
deallocate prealloced memory but calls cn_del_callback().
It looks like a misprint.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov at ispras.ru>
---
drivers/md/dm-log-userspace-transfer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
}
--
1.9.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://linuxtesting.org/pipermail/ldv-project/attachments/20141001/cae8fb35/attachment.html>
More information about the ldv-project
mailing list