Browse Source

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

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@huawei.com>
Cc: Bob Liu <bob.liu@oracle.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jie Liu 12 years ago
parent
commit
98f62b7a08
1 changed files with 3 additions and 0 deletions
  1. 3 0
      drivers/staging/zcache/ramster/tcp.c

+ 3 - 0
drivers/staging/zcache/ramster/tcp.c

@@ -403,6 +403,9 @@ static void sc_kref_release(struct kref *kref)
 	sc->sc_node = NULL;
 
 	r2net_debug_del_sc(sc);
+
+	if (sc->sc_page)
+		__free_page(sc->sc_page);
 	kfree(sc);
 }