2013-05-08 22:48:19

by Jonghwan Choi

[permalink] [raw]
Subject: [PATCH 3.9-stable] drbd: fix memory leak

This patch looks like it should be in the 3.9-stable tree, should we apply
it?

------------------

From: "Lars Ellenberg <[email protected]>"

commit 94ad0a101415978be04945b2787be1e8e8a874db upstream

We forgot to free the disk_conf,
so for each attach/detach cycle we leaked 336 bytes.

Signed-off-by: Philipp Reisner <[email protected]>
Signed-off-by: Lars Ellenberg <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Jonghwan Choi <[email protected]>
---
drivers/block/drbd/drbd_main.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index e98da67..54d03d4 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2795,6 +2795,7 @@ void drbd_free_bc(struct drbd_backing_dev *ldev)
blkdev_put(ldev->backing_bdev, FMODE_READ | FMODE_WRITE |
FMODE_EXCL);
blkdev_put(ldev->md_bdev, FMODE_READ | FMODE_WRITE | FMODE_EXCL);

+ kfree(ldev->disk_conf);
kfree(ldev);
}


2013-05-10 08:18:38

by Philipp Reisner

[permalink] [raw]
Subject: Re: [PATCH 3.9-stable] drbd: fix memory leak

Yes, please.

> This patch looks like it should be in the 3.9-stable tree, should we apply
> it?
>
> ------------------
>
> From: "Lars Ellenberg <[email protected]>"
>
> commit 94ad0a101415978be04945b2787be1e8e8a874db upstream
>
> We forgot to free the disk_conf,
> so for each attach/detach cycle we leaked 336 bytes.
>
> Signed-off-by: Philipp Reisner <[email protected]>
> Signed-off-by: Lars Ellenberg <[email protected]>
> Signed-off-by: Jens Axboe <[email protected]>
> Signed-off-by: Jonghwan Choi <[email protected]>
> ---
> drivers/block/drbd/drbd_main.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
> index e98da67..54d03d4 100644
> --- a/drivers/block/drbd/drbd_main.c
> +++ b/drivers/block/drbd/drbd_main.c
> @@ -2795,6 +2795,7 @@ void drbd_free_bc(struct drbd_backing_dev *ldev)
> blkdev_put(ldev->backing_bdev, FMODE_READ | FMODE_WRITE |
> FMODE_EXCL);
> blkdev_put(ldev->md_bdev, FMODE_READ | FMODE_WRITE | FMODE_EXCL);
>
> + kfree(ldev->disk_conf);
> kfree(ldev);
> }