* [PATCH v2 1/2] nbd: nbd_reset() call in nbd_dev_add() is redundant
@ 2017-05-23 15:49 Ilya Dryomov
2017-05-23 15:49 ` [PATCH v2 2/2] nbd: don't leak nbd_config Ilya Dryomov
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Ilya Dryomov @ 2017-05-23 15:49 UTC (permalink / raw)
To: Josef Bacik; +Cc: nbd-general, linux-block, Jens Axboe
There is nothing to clear -- nbd_device has just been allocated.
Fold nbd_reset() into its other caller, nbd_config_put().
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
---
drivers/block/nbd.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 9a7bb2c29447..e725d8d5ab0b 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -937,14 +937,6 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg)
return -ENOSPC;
}
-/* Reset all properties of an NBD device */
-static void nbd_reset(struct nbd_device *nbd)
-{
- nbd->config = NULL;
- nbd->tag_set.timeout = 0;
- queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, nbd->disk->queue);
-}
-
static void nbd_bdev_reset(struct block_device *bdev)
{
if (bdev->bd_openers > 1)
@@ -1029,7 +1021,10 @@ static void nbd_config_put(struct nbd_device *nbd)
}
kfree(config->socks);
}
- nbd_reset(nbd);
+ nbd->config = NULL;
+
+ nbd->tag_set.timeout = 0;
+ queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, nbd->disk->queue);
mutex_unlock(&nbd->config_lock);
nbd_put(nbd);
@@ -1483,7 +1478,6 @@ static int nbd_dev_add(int index)
disk->fops = &nbd_fops;
disk->private_data = nbd;
sprintf(disk->disk_name, "nbd%d", index);
- nbd_reset(nbd);
add_disk(disk);
nbd_total_devices++;
return index;
--
2.4.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] nbd: don't leak nbd_config
2017-05-23 15:49 [PATCH v2 1/2] nbd: nbd_reset() call in nbd_dev_add() is redundant Ilya Dryomov
@ 2017-05-23 15:49 ` Ilya Dryomov
2017-05-29 8:27 ` Ilya Dryomov
2017-05-30 13:00 ` Josef Bacik
2017-05-30 12:59 ` [PATCH v2 1/2] nbd: nbd_reset() call in nbd_dev_add() is redundant Josef Bacik
2017-05-30 14:15 ` Jens Axboe
2 siblings, 2 replies; 6+ messages in thread
From: Ilya Dryomov @ 2017-05-23 15:49 UTC (permalink / raw)
To: Josef Bacik; +Cc: nbd-general, linux-block, Jens Axboe
nbd_config is allocated in nbd_alloc_config(), but never freed.
Fixes: 5ea8d10802ec ("nbd: separate out the config information")
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
---
drivers/block/nbd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index e725d8d5ab0b..f3f191ba8ca4 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1021,6 +1021,7 @@ static void nbd_config_put(struct nbd_device *nbd)
}
kfree(config->socks);
}
+ kfree(nbd->config);
nbd->config = NULL;
nbd->tag_set.timeout = 0;
--
2.4.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] nbd: don't leak nbd_config
2017-05-23 15:49 ` [PATCH v2 2/2] nbd: don't leak nbd_config Ilya Dryomov
@ 2017-05-29 8:27 ` Ilya Dryomov
2017-05-30 13:00 ` Josef Bacik
1 sibling, 0 replies; 6+ messages in thread
From: Ilya Dryomov @ 2017-05-29 8:27 UTC (permalink / raw)
To: Josef Bacik; +Cc: nbd-general, linux-block, Jens Axboe
On Tue, May 23, 2017 at 5:49 PM, Ilya Dryomov <idryomov@gmail.com> wrote:
> nbd_config is allocated in nbd_alloc_config(), but never freed.
>
> Fixes: 5ea8d10802ec ("nbd: separate out the config information")
> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
> ---
> drivers/block/nbd.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index e725d8d5ab0b..f3f191ba8ca4 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -1021,6 +1021,7 @@ static void nbd_config_put(struct nbd_device *nbd)
> }
> kfree(config->socks);
> }
> + kfree(nbd->config);
> nbd->config = NULL;
>
> nbd->tag_set.timeout = 0;
Hi Josef,
Ping -- I think these should go into 4.12-rc, Jens is probably waiting
for your OK.
Thanks,
Ilya
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] nbd: nbd_reset() call in nbd_dev_add() is redundant
2017-05-23 15:49 [PATCH v2 1/2] nbd: nbd_reset() call in nbd_dev_add() is redundant Ilya Dryomov
2017-05-23 15:49 ` [PATCH v2 2/2] nbd: don't leak nbd_config Ilya Dryomov
@ 2017-05-30 12:59 ` Josef Bacik
2017-05-30 14:15 ` Jens Axboe
2 siblings, 0 replies; 6+ messages in thread
From: Josef Bacik @ 2017-05-30 12:59 UTC (permalink / raw)
To: Ilya Dryomov; +Cc: Josef Bacik, nbd-general, linux-block, Jens Axboe
On Tue, May 23, 2017 at 05:49:54PM +0200, Ilya Dryomov wrote:
> There is nothing to clear -- nbd_device has just been allocated.
> Fold nbd_reset() into its other caller, nbd_config_put().
>
> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Thanks,
Josef
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] nbd: don't leak nbd_config
2017-05-23 15:49 ` [PATCH v2 2/2] nbd: don't leak nbd_config Ilya Dryomov
2017-05-29 8:27 ` Ilya Dryomov
@ 2017-05-30 13:00 ` Josef Bacik
1 sibling, 0 replies; 6+ messages in thread
From: Josef Bacik @ 2017-05-30 13:00 UTC (permalink / raw)
To: Ilya Dryomov; +Cc: Josef Bacik, nbd-general, linux-block, Jens Axboe
On Tue, May 23, 2017 at 05:49:55PM +0200, Ilya Dryomov wrote:
> nbd_config is allocated in nbd_alloc_config(), but never freed.
>
> Fixes: 5ea8d10802ec ("nbd: separate out the config information")
> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Thanks,
Josef
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] nbd: nbd_reset() call in nbd_dev_add() is redundant
2017-05-23 15:49 [PATCH v2 1/2] nbd: nbd_reset() call in nbd_dev_add() is redundant Ilya Dryomov
2017-05-23 15:49 ` [PATCH v2 2/2] nbd: don't leak nbd_config Ilya Dryomov
2017-05-30 12:59 ` [PATCH v2 1/2] nbd: nbd_reset() call in nbd_dev_add() is redundant Josef Bacik
@ 2017-05-30 14:15 ` Jens Axboe
2 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2017-05-30 14:15 UTC (permalink / raw)
To: Ilya Dryomov, Josef Bacik; +Cc: nbd-general, linux-block
On 05/23/2017 09:49 AM, Ilya Dryomov wrote:
> There is nothing to clear -- nbd_device has just been allocated.
> Fold nbd_reset() into its other caller, nbd_config_put().
Added 1+2 for 4.12.
--
Jens Axboe
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-05-30 14:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-23 15:49 [PATCH v2 1/2] nbd: nbd_reset() call in nbd_dev_add() is redundant Ilya Dryomov
2017-05-23 15:49 ` [PATCH v2 2/2] nbd: don't leak nbd_config Ilya Dryomov
2017-05-29 8:27 ` Ilya Dryomov
2017-05-30 13:00 ` Josef Bacik
2017-05-30 12:59 ` [PATCH v2 1/2] nbd: nbd_reset() call in nbd_dev_add() is redundant Josef Bacik
2017-05-30 14:15 ` Jens Axboe
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.