From: Cong Wang <amwang@redhat.com>
To: Anca Emanuel <anca.emanuel@gmail.com>
Cc: linux-kernel@vger.kernel.org,
WANG Cong <xiyou.wangcong@gmail.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Al Viro <viro@zeniv.linux.org.uk>,
Andrew Morton <akpm@linux-foundation.org>,
Eric B Munson <emunson@mgebm.net>,
David Rientjes <rientjes@google.com>,
Dave Hansen <dave@linux.vnet.ibm.com>, Mel Gorman <mel@csn.ul.ie>,
linux-fsdevel@vger.kernel.org
Subject: Re: [Patch V2] proc: check error pointer returned by m_start()
Date: Mon, 28 Mar 2011 13:49:09 +0800 [thread overview]
Message-ID: <4D902155.8040602@redhat.com> (raw)
In-Reply-To: <AANLkTik32QRUMaKF1aZ02Crh+RFG_4VOCFgPUPnCNLZA@mail.gmail.com>
于 2011年03月28日 13:46, Anca Emanuel 写道:
> On Mon, Mar 28, 2011 at 8:26 AM, Amerigo Wang<amwang@redhat.com> wrote:
>> From: WANG Cong<xiyou.wangcong@gmail.com>
>>
>> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
>> index 7c708a4..8e59169 100644
>> --- a/fs/proc/task_mmu.c
>> +++ b/fs/proc/task_mmu.c
>> @@ -124,8 +124,10 @@ static void *m_start(struct seq_file *m, loff_t *pos)
>> return ERR_PTR(-ESRCH);
>>
>> mm = mm_for_maps(priv->task);
>> - if (!mm || IS_ERR(mm))
>> + if (IS_ERR_OR_NULL(mm)) {
>> + put_task_struct(priv->task);
>> return mm;
>> + }
>> down_read(&mm->mmap_sem);
>>
>> tail_vma = get_gate_vma(priv->task->mm);
>> @@ -182,6 +184,8 @@ static void m_stop(struct seq_file *m, void *v)
>> struct proc_maps_private *priv = m->private;
>> struct vm_area_struct *vma = v;
>>
>> + if (IS_ERR_OR_NULL(v))
>> + return;
>
> Note: this is not functional equivalent with the previous patch.
>
I moved that put_task_struct() into m_start() itself.
>
> I din't test the above patch.
>
> Linus already have the fix in his tree.
Yes, I really should pull before I made a patch. :-/
Anyway, thanks for reporting and testing.
prev parent reply other threads:[~2011-03-28 5:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <AANLkTi=mqKF=xeMYbj9LZgPfSLHSkO1JRXsNTW3LyHqu@mail.gmail.com>
2011-03-28 5:26 ` [Patch V2] proc: check error pointer returned by m_start() Amerigo Wang
2011-03-28 5:45 ` Cong Wang
2011-03-28 5:46 ` Anca Emanuel
2011-03-28 5:49 ` Cong Wang [this message]
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=4D902155.8040602@redhat.com \
--to=amwang@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=anca.emanuel@gmail.com \
--cc=dave@linux.vnet.ibm.com \
--cc=emunson@mgebm.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mel@csn.ul.ie \
--cc=rientjes@google.com \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
--cc=xiyou.wangcong@gmail.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 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).