ocfs2: Free sc->sc_page in sc_kref_release()
PATCH 1/1 ocfs2: Free sc->sc_page in sc_kref_release()
There is a memory leak in sc_kref_release().
When free struct o2net_sock_container (sc),
we should release sc->sc_page.
--- fs/ocfs2/cluster/tcp.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/ocfs2/cluster/tcp.c +5 -0
@@ -406,6 +406,11 @@ static void sc_kref_release(struct kref *kref) sc->sc_node =NULL ;o2net_debug_del_sc (sc); + +if (sc->sc_page) { +__free_page (sc->sc_page); + sc->sc_page =NULL ; + }kfree (sc); }
-- 1.7.9.7
PATCH 1/1 ocfs2: Free sc->sc_page in sc_kref_release()
Quoted 5 lines · Younger Liu
There is a memory leak in
sc_kref_release().
When free structo2net_sock_container(sc),
we should releasesc->sc_page.Signed-off-by Younger Liu <[email protected]>
Looks fine to me, thanks!
Quoted 21 lines
--- fs/ocfs2/cluster/tcp.c | 5 +++++ 1 file changed, 5 insertions(+)fs/ocfs2/cluster/tcp.c +5
-1@@ -406,6 +406,11 @@ static void sc_kref_release(struct kref *kref) sc->sc_node =NULL ;o2net_debug_del_sc (sc); + +if (sc->sc_page) { +__free_page (sc->sc_page); + sc->sc_page =NULL ; + }kfree (sc); } -- 1.7.9.7
PATCH 1/1 ocfs2: Free sc->sc_page in sc_kref_release()
Quoted 23 lines · Jeff Liu
Quoted 5 lines · Younger Liu
There is a memory leak in
sc_kref_release().
When free structo2net_sock_container(sc),
we should releasesc->sc_page.Signed-off-by Younger Liu <[email protected]>Looks fine to me, thanks!
Reviewed-by Jie Liu <[email protected]>Quoted 11 lines
--- fs/ocfs2/cluster/tcp.c | 5 +++++ 1 file changed, 5 insertions(+)fs/ocfs2/cluster/tcp.c +0
-0@@ -406,6 +406,11 @@ static void sc_kref_release(struct kref *kref) sc->sc_node =NULL ;
Quoted 5 lines
fs/ocfs2/cluster/tcp.c static void sc_kref_release(struct kref *kref) · line 412
Quoted 5 lines
fs/ocfs2/cluster/tcp.c +4
-0o2net_debug_del_sc (sc); + +if (sc->sc_page) { +__free_page (sc->sc_page); + sc->sc_page =NULL ;
But why set sc->sc_page to NULL, given sc is to be kfreed.
Quoted 3 lines
Quoted 3 lines
fs/ocfs2/cluster/tcp.c +1
-0+ }kfree (sc); }
PATCH 1/1 ocfs2: Free sc->sc_page in sc_kref_release()
Quoted 24 lines · Li Zefan
Quoted 23 lines · Jeff Liu
Quoted 5 lines · Younger Liu
There is a memory leak in
sc_kref_release().
When free structo2net_sock_container(sc),
we should releasesc->sc_page.Signed-off-by Younger Liu <[email protected]>Looks fine to me, thanks!
Reviewed-by Jie Liu <[email protected]>Quoted 11 lines
--- fs/ocfs2/cluster/tcp.c | 5 +++++ 1 file changed, 5 insertions(+)fs/ocfs2/cluster/tcp.c +0
-0@@ -406,6 +406,11 @@ static void sc_kref_release(struct kref *kref) sc->sc_node =NULL ;
Quoted 7 lines
Quoted 5 lines
fs/ocfs2/cluster/tcp.c static void sc_kref_release(struct kref *kref) · line 412
Quoted 5 lines
fs/ocfs2/cluster/tcp.c +4
-0o2net_debug_del_sc (sc); + +if (sc->sc_page) { +__free_page (sc->sc_page); + sc->sc_page =NULL ;But why set
sc->sc_pageto NULL, given sc is to be kfreed.
Nice catch. I have not reacted from another thing in process at that time.
Thanks,
-Jeff
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
fs/ocfs2/cluster/tcp.c +1
-0+ }kfree (sc); }
PATCH 1/1 ocfs2: Free sc->sc_page in sc_kref_release()
Thanks for your review comments.
I will resend this patch.
Quoted 48 lines · Jeff Liu
Quoted 24 lines · Li Zefan
Quoted 23 lines · Jeff Liu
Quoted 5 lines · Younger Liu
There is a memory leak in
sc_kref_release().
When free structo2net_sock_container(sc),
we should releasesc->sc_page.Signed-off-by Younger Liu <[email protected]>Looks fine to me, thanks!
Reviewed-by Jie Liu <[email protected]>Quoted 11 lines
--- fs/ocfs2/cluster/tcp.c | 5 +++++ 1 file changed, 5 insertions(+)fs/ocfs2/cluster/tcp.c +0
-0@@ -406,6 +406,11 @@ static void sc_kref_release(struct kref *kref) sc->sc_node =NULL ;Quoted 7 lines
Quoted 5 lines
fs/ocfs2/cluster/tcp.c static void sc_kref_release(struct kref *kref) · line 412
Quoted 5 lines
fs/ocfs2/cluster/tcp.c +4
-0o2net_debug_del_sc (sc); + +if (sc->sc_page) { +__free_page (sc->sc_page); + sc->sc_page =NULL ;But why set
sc->sc_pageto NULL, given sc is to be kfreed.Nice catch. I have not reacted from another thing in process at that time.
Thanks,
-JeffQuoted 5 lines
Quoted 4 lines
Quoted 4 lines
fs/ocfs2/cluster/tcp.c +1
-0+ }kfree (sc); }