linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ocfs2: free 'dummy_sc' in sc_fop_release() in case of memory leak
@ 2017-06-25 12:46 piaojun
  2017-06-26  9:44 ` [Ocfs2-devel] " Joseph Qi
  0 siblings, 1 reply; 2+ messages in thread
From: piaojun @ 2017-06-25 12:46 UTC (permalink / raw)
  To: mfasheh, jlbec; +Cc: linux-kernel, ocfs2-devel

'sd->dbg_sock' is malloc in sc_common_open(), but not freed at the end
of sc_fop_release().

Signed-off-by: Jun Piao <piaojun@huawei.com>
---
 fs/ocfs2/cluster/netdebug.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/ocfs2/cluster/netdebug.c b/fs/ocfs2/cluster/netdebug.c
index 564c504..74a21f6 100644
--- a/fs/ocfs2/cluster/netdebug.c
+++ b/fs/ocfs2/cluster/netdebug.c
@@ -426,6 +426,7 @@ static int sc_fop_release(struct inode *inode, struct file *file)
 	struct o2net_sock_container *dummy_sc = sd->dbg_sock;

 	o2net_debug_del_sc(dummy_sc);
+	kfree(dummy_sc);
 	return seq_release_private(inode, file);
 }

-- 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Ocfs2-devel] [PATCH] ocfs2: free 'dummy_sc' in sc_fop_release() in case of memory leak
  2017-06-25 12:46 [PATCH] ocfs2: free 'dummy_sc' in sc_fop_release() in case of memory leak piaojun
@ 2017-06-26  9:44 ` Joseph Qi
  0 siblings, 0 replies; 2+ messages in thread
From: Joseph Qi @ 2017-06-26  9:44 UTC (permalink / raw)
  To: piaojun, mfasheh, jlbec; +Cc: linux-kernel, ocfs2-devel, akpm



On 17/6/25 20:46, piaojun wrote:
> 'sd->dbg_sock' is malloc in sc_common_open(), but not freed at the end
> of sc_fop_release().
> 
> Signed-off-by: Jun Piao <piaojun@huawei.com>
Looks good.
Reviewed-by: Joseph Qi <jiangqi903@gmail.com>

Thanks,
Joseph

> ---
>  fs/ocfs2/cluster/netdebug.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/ocfs2/cluster/netdebug.c b/fs/ocfs2/cluster/netdebug.c
> index 564c504..74a21f6 100644
> --- a/fs/ocfs2/cluster/netdebug.c
> +++ b/fs/ocfs2/cluster/netdebug.c
> @@ -426,6 +426,7 @@ static int sc_fop_release(struct inode *inode, struct file *file)
>  	struct o2net_sock_container *dummy_sc = sd->dbg_sock;
> 
>  	o2net_debug_del_sc(dummy_sc);
> +	kfree(dummy_sc);
>  	return seq_release_private(inode, file);
>  }
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-26  9:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-25 12:46 [PATCH] ocfs2: free 'dummy_sc' in sc_fop_release() in case of memory leak piaojun
2017-06-26  9:44 ` [Ocfs2-devel] " Joseph Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).