public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix a leak in bch_cached_dev_run()
@ 2014-10-30  5:42 Al Viro
  2014-11-01 20:38 ` Kent Overstreet
  0 siblings, 1 reply; 2+ messages in thread
From: Al Viro @ 2014-10-30  5:42 UTC (permalink / raw)
  To: Kent Overstreet; +Cc: linux-kernel, linux-bcache

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -878,8 +878,11 @@ void bch_cached_dev_run(struct cached_dev *dc)
 	buf[SB_LABEL_SIZE] = '\0';
 	env[2] = kasprintf(GFP_KERNEL, "CACHED_LABEL=%s", buf);
 
-	if (atomic_xchg(&dc->running, 1))
+	if (atomic_xchg(&dc->running, 1)) {
+		kfree(env[1]);
+		kfree(env[2]);
 		return;
+	}
 
 	if (!d->c &&
 	    BDEV_STATE(&dc->sb) != BDEV_STATE_NONE) {

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

end of thread, other threads:[~2014-11-01 20:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-30  5:42 [PATCH] fix a leak in bch_cached_dev_run() Al Viro
2014-11-01 20:38 ` Kent Overstreet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox