linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dm-log-userspace: fix memory leak on failure path in dm_ulog_tfr_init()
@ 2014-10-01 20:58 Alexey Khoroshilov
  2014-10-02 16:57 ` Brassow Jonathan
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Khoroshilov @ 2014-10-01 20:58 UTC (permalink / raw)
  To: Alasdair Kergon, Mike Snitzer
  Cc: Alexey Khoroshilov, dm-devel, Neil Brown, linux-raid,
	linux-kernel, ldv-project

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@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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dm-log-userspace: fix memory leak on failure path in dm_ulog_tfr_init()
  2014-10-01 20:58 [PATCH] dm-log-userspace: fix memory leak on failure path in dm_ulog_tfr_init() Alexey Khoroshilov
@ 2014-10-02 16:57 ` Brassow Jonathan
  0 siblings, 0 replies; 2+ messages in thread
From: Brassow Jonathan @ 2014-10-02 16:57 UTC (permalink / raw)
  To: Alexey Khoroshilov
  Cc: Alasdair Kergon, Mike Snitzer, dm-devel, Neil Brown, linux-raid,
	linux-kernel, ldv-project

On Oct 1, 2014, at 3:58 PM, Alexey Khoroshilov <khoroshilov@ispras.ru> wrote:

> 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@ispras.ru>

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-02 16:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-01 20:58 [PATCH] dm-log-userspace: fix memory leak on failure path in dm_ulog_tfr_init() Alexey Khoroshilov
2014-10-02 16:57 ` Brassow Jonathan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).