All of lore.kernel.org
 help / color / mirror / Atom feed
From: piaojun <piaojun@huawei.com>
To: mfasheh@versity.com, jlbec@evilplan.org
Cc: linux-kernel@vger.kernel.org,
	"ocfs2-devel@oss.oracle.com" <ocfs2-devel@oss.oracle.com>
Subject: [Ocfs2-devel] [PATCH] ocfs2: free 'dummy_sc' in sc_fop_release() in case of memory leak
Date: Sun, 25 Jun 2017 20:46:28 +0800	[thread overview]
Message-ID: <594FB0A4.2050105@huawei.com> (raw)

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

-- 

WARNING: multiple messages have this Message-ID (diff)
From: piaojun <piaojun@huawei.com>
To: <mfasheh@versity.com>, <jlbec@evilplan.org>
Cc: <linux-kernel@vger.kernel.org>,
	"ocfs2-devel@oss.oracle.com" <ocfs2-devel@oss.oracle.com>
Subject: [PATCH] ocfs2: free 'dummy_sc' in sc_fop_release() in case of memory leak
Date: Sun, 25 Jun 2017 20:46:28 +0800	[thread overview]
Message-ID: <594FB0A4.2050105@huawei.com> (raw)

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

-- 

             reply	other threads:[~2017-06-25 12:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-25 12:46 piaojun [this message]
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
2017-06-26  9:44   ` Joseph Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=594FB0A4.2050105@huawei.com \
    --to=piaojun@huawei.com \
    --cc=jlbec@evilplan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mfasheh@versity.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.