Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1674209 > unrolled thread

[PATCH] ocfs2: free 'dummy_sc' in sc_fop_release() in case of memory leak

Started bypiaojun <piaojun@huawei.com>
First post2017-06-25 15:00 +0200
Last post2017-06-26 11:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] ocfs2: free 'dummy_sc' in sc_fop_release() in case of memory  leak piaojun <piaojun@huawei.com> - 2017-06-25 15:00 +0200
    Re: [Ocfs2-devel] [PATCH] ocfs2: free 'dummy_sc' in sc_fop_release()  in case of memory leak Joseph Qi <jiangqi903@gmail.com> - 2017-06-26 11:50 +0200

#1674209 — [PATCH] ocfs2: free 'dummy_sc' in sc_fop_release() in case of memory leak

Frompiaojun <piaojun@huawei.com>
Date2017-06-25 15:00 +0200
Subject[PATCH] ocfs2: free 'dummy_sc' in sc_fop_release() in case of memory leak
Message-ID<tWfiW-5cl-7@gated-at.bofh.it>
'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);
 }

-- 

[toc] | [next] | [standalone]


#1674575 — Re: [Ocfs2-devel] [PATCH] ocfs2: free 'dummy_sc' in sc_fop_release() in case of memory leak

FromJoseph Qi <jiangqi903@gmail.com>
Date2017-06-26 11:50 +0200
SubjectRe: [Ocfs2-devel] [PATCH] ocfs2: free 'dummy_sc' in sc_fop_release() in case of memory leak
Message-ID<tWyOC-EC-11@gated-at.bofh.it>
In reply to#1674209

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);
>  }
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web