drbd: fix memory leak
Subsystems (3)
PATCH 1/1 drbd: fix memory leak
We leak memory if "--dry-run" is not supported by the peer.
Signed-off-by Dan Carpenter <[email protected]>
drivers/block/drbd/drbd_main.c +1 -0
@@ -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 ; } }
Quoted 9 lines · Dan Carpenter
We leak memory if "--dry-run" is not supported by the peer.
Signed-off-by Dan Carpenter <[email protected]>drivers/block/drbd/drbd_main.c +0
-0
drivers/block/drbd/drbd_main.c int drbd_send_protocol(struct drbd_conf *mdev) · line 1701
Quoted 7 lines
drivers/block/drbd/drbd_main.c +1
-0@@ -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.
Signature · 1 line
Jens Axboe
Philipp Reisner
maintainerHi 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
Philipp Reisner
maintainerPATCH 1/1 drbd: Terminate a connection early if sending the protocol fails
Signed-off-by Philipp Reisner <[email protected]>
Signed-off-by Lars Ellenberg <[email protected]>
--- drivers/block/drbd/drbd_receiver.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/block/drbd/drbd_receiver.c +2 -1
@@ -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);
Signature · 1 line
1.6.3.3
Quoted 5 lines · Philipp Reisner
Hi Jens,
Please apply the following patch as well.
PS: I have put both at
git://git.drbd.org/linux-2.6-drbd.gitfor-jens
Thanks, I just hand applied the 2nd one since the first one was already there.
Signature · 1 line
Jens Axboe