[PATCH] staging/zcache: Fix memory leak while dropping an o2net_sock_container object

Jeff Liu jeff.liu at oracle.com
Sun Aug 4 12:06:20 UTC 2013

From: Jie Liu <jeff.liu at oracle.com>

Free sc->sc_page when releasing a struct o2net_sock_container
object to avoid memory leaks.

This issue has been fixed by Younger Liu for OCFS2, so I sync
that patch to zcache as we share the same network code base.

Cc: Younger Liu <younger.liu at huawei.com>
Cc: Bob Liu <bob.liu at oracle.com>
Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
Signed-off-by: Jie Liu <jeff.liu at oracle.com>
 drivers/staging/zcache/ramster/tcp.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/zcache/ramster/tcp.c b/drivers/staging/zcache/ramster/tcp.c
index f6e1e52..f74881e 100644
--- a/drivers/staging/zcache/ramster/tcp.c
+++ b/drivers/staging/zcache/ramster/tcp.c
@@ -403,6 +403,9 @@ static void sc_kref_release(struct kref *kref)
 	sc->sc_node = NULL;
+	if (sc->sc_page)
+		__free_page(sc->sc_page);

More information about the devel mailing list