Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753529Ab1C1FuQ (ORCPT ); Mon, 28 Mar 2011 01:50:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36040 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752178Ab1C1FuP (ORCPT ); Mon, 28 Mar 2011 01:50:15 -0400 Message-ID: <4D902155.8040602@redhat.com> Date: Mon, 28 Mar 2011 13:49:09 +0800 From: Cong Wang User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9 MIME-Version: 1.0 To: Anca Emanuel 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 Subject: Re: [Patch V2] proc: check error pointer returned by m_start() References: <1301289993-24248-1-git-send-email-amwang@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1518 Lines: 45 于 2011年03月28日 13:46, Anca Emanuel 写道: > On Mon, Mar 28, 2011 at 8:26 AM, Amerigo Wang wrote: >> 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 = 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. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/