* [PATCH] fix a leak in bch_cached_dev_run()
@ 2015-02-03 11:24 Joshua Schmid
0 siblings, 0 replies; 3+ messages in thread
From: Joshua Schmid @ 2015-02-03 11:24 UTC (permalink / raw)
To: linux-bcache; +Cc: Al Viro, Al Viro
From: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Tested-by: Joshua Schmid <jschmid@suse.com>
---
drivers/md/bcache/super.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 8c2d657..53f1512 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -880,8 +880,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) {
--
2.1.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [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, 0 replies; 3+ messages in thread
From: Kent Overstreet @ 2014-11-01 20:38 UTC (permalink / raw)
To: Al Viro; +Cc: linux-kernel, linux-bcache
On Thu, Oct 30, 2014 at 05:42:09AM +0000, Al Viro wrote:
> 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) {
Thanks, applied
^ permalink raw reply [flat|nested] 3+ messages in thread
* [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; 3+ 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] 3+ messages in thread
end of thread, other threads:[~2015-02-03 11:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-03 11:24 [PATCH] fix a leak in bch_cached_dev_run() Joshua Schmid
-- strict thread matches above, loose matches on Subject: below --
2014-10-30 5:42 Al Viro
2014-11-01 20:38 ` Kent Overstreet
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.