* [Drbd-dev] [patch] drbd: fix memory leak
@ 2010-04-22 9:56 Dan Carpenter
2010-04-22 12:27 ` Jens Axboe
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2010-04-22 9:56 UTC (permalink / raw)
To: Lars Ellenberg
Cc: Kamalesh Babulal, kernel-janitors, Philipp Reisner, drbd-user,
Jens Axboe
We leak memory if "--dry-run" is not supported by the peer.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 67e0fc5..93d1f9b 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -1695,6 +1695,7 @@ int drbd_send_protocol(struct drbd_conf *mdev)
cf |= CF_DRY_RUN;
else {
dev_err(DEV, "--dry-run is not supported by peer");
+ kfree(p);
return 0;
}
}
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [Drbd-dev] [patch] drbd: fix memory leak
2010-04-22 9:56 [Drbd-dev] [patch] drbd: fix memory leak Dan Carpenter
@ 2010-04-22 12:27 ` Jens Axboe
2010-04-22 12:47 ` Philipp Reisner
0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2010-04-22 12:27 UTC (permalink / raw)
To: Dan Carpenter
Cc: Kamalesh Babulal, kernel-janitors, Philipp Reisner, drbd-user,
Lars Ellenberg
On Thu, Apr 22 2010, Dan Carpenter wrote:
> We leak memory if "--dry-run" is not supported by the peer.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
> index 67e0fc5..93d1f9b 100644
> --- a/drivers/block/drbd/drbd_main.c
> +++ b/drivers/block/drbd/drbd_main.c
> @@ -1695,6 +1695,7 @@ int drbd_send_protocol(struct drbd_conf *mdev)
> cf |= CF_DRY_RUN;
> else {
> dev_err(DEV, "--dry-run is not supported by peer");
> + kfree(p);
> return 0;
> }
> }
Yep, that's a leak. I have applied it for 2.6.34.
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Drbd-dev] [patch] drbd: fix memory leak
2010-04-22 12:27 ` Jens Axboe
@ 2010-04-22 12:47 ` Philipp Reisner
2010-04-22 12:47 ` [Drbd-dev] [PATCH 1/1] drbd: Terminate a connection early if sending the protocol fails Philipp Reisner
2010-04-22 12:50 ` [Drbd-dev] [patch] drbd: fix memory leak Jens Axboe
0 siblings, 2 replies; 5+ messages in thread
From: Philipp Reisner @ 2010-04-22 12:47 UTC (permalink / raw)
To: Jens Axboe; +Cc: Kamalesh Babulal, kernel-janitors, Dan Carpenter, drbd-dev
Hi Jens,
Please apply the following patch as well.
PS: I have put both at git://git.drbd.org/linux-2.6-drbd.git for-jens
Best,
Phil
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Drbd-dev] [PATCH 1/1] drbd: Terminate a connection early if sending the protocol fails
2010-04-22 12:47 ` Philipp Reisner
@ 2010-04-22 12:47 ` Philipp Reisner
2010-04-22 12:50 ` [Drbd-dev] [patch] drbd: fix memory leak Jens Axboe
1 sibling, 0 replies; 5+ messages in thread
From: Philipp Reisner @ 2010-04-22 12:47 UTC (permalink / raw)
To: Jens Axboe; +Cc: Kamalesh Babulal, kernel-janitors, Dan Carpenter, drbd-dev
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
drivers/block/drbd/drbd_receiver.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index ed9f1de..3f096e7 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -899,7 +899,8 @@ retry:
drbd_thread_start(&mdev->asender);
- drbd_send_protocol(mdev);
+ if (!drbd_send_protocol(mdev))
+ return -1;
drbd_send_sync_param(mdev, &mdev->sync_conf);
drbd_send_sizes(mdev, 0);
drbd_send_uuids(mdev);
--
1.6.3.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Drbd-dev] [patch] drbd: fix memory leak
2010-04-22 12:47 ` Philipp Reisner
2010-04-22 12:47 ` [Drbd-dev] [PATCH 1/1] drbd: Terminate a connection early if sending the protocol fails Philipp Reisner
@ 2010-04-22 12:50 ` Jens Axboe
1 sibling, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2010-04-22 12:50 UTC (permalink / raw)
To: Philipp Reisner
Cc: Kamalesh Babulal, kernel-janitors, Dan Carpenter, drbd-dev
On Thu, Apr 22 2010, Philipp Reisner wrote:
> Hi Jens,
>
> Please apply the following patch as well.
>
> PS: I have put both at git://git.drbd.org/linux-2.6-drbd.git for-jens
Thanks, I just hand applied the 2nd one since the first one was already
there.
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-04-22 12:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-22 9:56 [Drbd-dev] [patch] drbd: fix memory leak Dan Carpenter
2010-04-22 12:27 ` Jens Axboe
2010-04-22 12:47 ` Philipp Reisner
2010-04-22 12:47 ` [Drbd-dev] [PATCH 1/1] drbd: Terminate a connection early if sending the protocol fails Philipp Reisner
2010-04-22 12:50 ` [Drbd-dev] [patch] drbd: fix memory leak Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox