[ofa-general] [patch] fix SDP page leak in sdp_bz_cleanup

Lars Ellenberg lars.ellenberg at linbit.com
Wed Jul 1 05:52:26 PDT 2009


Hi there.

Please direct me to the right place for posting patches
and contacting developers, in case this is not it.

A few days ago I started to try using SDP as DRBD replication transport.
(http://www.drbd.org for those of you that do not know us yet)

As block traffic naturally is mostly large messages (several pages),
I noticed pretty quickly a large memory leak in SDP.

I think I can pin it down on sdp_bz_cleanup not doing the put_page().

patch against current ofed 1.5,
also applies to the 1.4 branch.

All the best,

	Lars

from git://git.openfabrics.org/ofed_1_5/linux-2.6.git

diff --git a/drivers/infiniband/ulp/sdp/sdp_main.c b/drivers/infiniband/ulp/sdp/sdp_main.c
index 8e1a6d7..1740408 100644
--- a/drivers/infiniband/ulp/sdp/sdp_main.c
+++ b/drivers/infiniband/ulp/sdp/sdp_main.c
@@ -1368,7 +1368,8 @@ static inline struct bzcopy_state *sdp_bz_cleanup(struct bzcopy_state *bz)
 	}
 
 	if (bz->pages) {
-		for (i = bz->cur_page; i < bz->page_cnt; i++)
+		/* match get_page() calls in sdp_bz_setup() */
+		for (i = 0; i < bz->page_cnt; i++)
 			put_page(bz->pages[i]);
 
 		kfree(bz->pages);



-- 
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.



More information about the general mailing list