From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cong Wang Subject: Re: [Patch V2] proc: check error pointer returned by m_start() Date: Mon, 28 Mar 2011 13:49:09 +0800 Message-ID: <4D902155.8040602@redhat.com> References: <1301289993-24248-1-git-send-email-amwang@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-kernel@vger.kernel.org, WANG Cong , Linus Torvalds , Al Viro , Andrew Morton , Eric B Munson , David Rientjes , Dave Hansen , Mel Gorman , linux-fsdevel@vger.kernel.org To: Anca Emanuel Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org =E4=BA=8E 2011=E5=B9=B403=E6=9C=8828=E6=97=A5 13:46, Anca Emanuel =E5=86= =99=E9=81=93: > On Mon, Mar 28, 2011 at 8:26 AM, Amerigo Wang wro= te: >> From: WANG Cong >> >> 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 =3D 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 =3D 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 =3D m->private; >> struct vm_area_struct *vma =3D 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.