All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Liu <jeff.liu@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2: Free sc->sc_page in sc_kref_release()
Date: Tue, 18 Jun 2013 12:35:14 +0800	[thread overview]
Message-ID: <51BFE382.8010408@oracle.com> (raw)
In-Reply-To: <51BFE213.6040700@huawei.com>

On 06/18/2013 12:29 PM, Li Zefan wrote:

> On 2013/6/18 12:20, Jeff Liu wrote:
>> On 06/18/2013 11:40 AM, Younger Liu wrote:
>>
>>> There is a memory leak in sc_kref_release().
>>> When free struct o2net_sock_container (sc), 
>>> we should release sc->sc_page.
>>>
>>> Signed-off-by: Younger Liu <younger.liu@huawei.com>
>>
>> Looks fine to me, thanks!
>>
>> Reviewed-by: Jie Liu <jeff.liu@oracle.com>
>>
>>> ---
>>>  fs/ocfs2/cluster/tcp.c |    5 +++++
>>>  1 file changed, 5 insertions(+)
>>>
>>> diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
>>> index aa88bd8..f0272b9 100644
>>> --- a/fs/ocfs2/cluster/tcp.c
>>> +++ b/fs/ocfs2/cluster/tcp.c
>>> @@ -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;
> 
> But why set sc->sc_page to NULL, given sc is to be kfreed.

Nice catch. I have not reacted from another thing in process at that time.

Thanks,
-Jeff

> 
>>> +	}
>>>  	kfree(sc);
>>>  }
> 

  reply	other threads:[~2013-06-18  4:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-18  3:40 [Ocfs2-devel] [PATCH] ocfs2: Free sc->sc_page in sc_kref_release() Younger Liu
2013-06-18  4:20 ` Jeff Liu
2013-06-18  4:29   ` Li Zefan
2013-06-18  4:35     ` Jeff Liu [this message]
2013-06-18  5:57       ` Younger Liu

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=51BFE382.8010408@oracle.com \
    --to=jeff.liu@oracle.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.