linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Revert "kernel/relay.c: fix potential memory leak"
       [not found] <089e082d01d08b36a6055cd763ca@google.com>
@ 2018-01-27  0:47 ` Eric Biggers
  0 siblings, 0 replies; only message in thread
From: Eric Biggers @ 2018-01-27  0:47 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton
  Cc: Zhouyi Zhou, Jens Axboe, linux-block, syzkaller-bugs,
	Eric Biggers, stable

From: Eric Biggers <ebiggers@google.com>

This reverts commit ba62bafe942b159a6109cbec780d36496e06b6c5.

This commit introduced a double free bug, because 'chan' is already
freed by the line:

    kref_put(&chan->kref, relay_destroy_channel);

This bug was found by syzkaller, using the BLKTRACESETUP ioctl.

Fixes: ba62bafe942b ("kernel/relay.c: fix potential memory leak")
Reported-by: syzbot <syzkaller@googlegroups.com>
Cc: <stable@vger.kernel.org> # v4.7+
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 kernel/relay.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/relay.c b/kernel/relay.c
index 39a9dfc69486..55da824f4adc 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -611,7 +611,6 @@ struct rchan *relay_open(const char *base_filename,
 
 	kref_put(&chan->kref, relay_destroy_channel);
 	mutex_unlock(&relay_channels_mutex);
-	kfree(chan);
 	return NULL;
 }
 EXPORT_SYMBOL_GPL(relay_open);
-- 
2.16.0.rc1.238.g530d649a79-goog

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-01-27  0:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <089e082d01d08b36a6055cd763ca@google.com>
2018-01-27  0:47 ` [PATCH] Revert "kernel/relay.c: fix potential memory leak" Eric Biggers

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).