diff mbox

[v2,2/2] nbd: don't leak nbd_config

Message ID 1495554595-30945-2-git-send-email-idryomov@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ilya Dryomov May 23, 2017, 3:49 p.m. UTC
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(+)

Comments

Ilya Dryomov May 29, 2017, 8:27 a.m. UTC | #1
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
Josef Bacik May 30, 2017, 1 p.m. UTC | #2
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
diff mbox

Patch

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;