From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Kirill A. Shutemov" Subject: Re: [PATCH][BUGFIX] readahead: fix NULL filp dereference Date: Fri, 2 Apr 2010 15:18:04 +0300 Message-ID: References: <3d0408631003252040r70c54b2fm24d64b819c59c9c@mail.gmail.com> <20100326040114.GA20717@localhost> <20100402072750.GA22952@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: Andrew Morton , stable@kernel.org, "Yan, Zheng" , "linux-btrfs@vger.kernel.org" , LKML , Jens Axboe To: Wu Fengguang Return-path: In-Reply-To: <20100402072750.GA22952@localhost> List-ID: On Fri, Apr 2, 2010 at 10:27 AM, Wu Fengguang = wrote: > The btrfs relocate_file_extent_cluster() calls us with NULL filp: > > =C2=A0[ 4005.426805] BUG: unable to handle kernel NULL pointer derefe= rence at 00000021 > =C2=A0[ 4005.426818] IP: [] page_cache_sync_readahead+0x18/= 0x3e > > CC: Yan Zheng > Reported-by: Kirill A. Shutemov > Signed-off-by: Wu Fengguang > --- > > Andrew and Greg: > > This is an obvious correct bug fix for .34 and .33-stable, > so I'm resending it directly to you without Kirill's confirmation. Sorry. Tested-by: Kirill A. Shutemov > --- sound-2.6.orig/mm/readahead.c =C2=A0 =C2=A0 =C2=A0 2010-03-26 11:= 51:57.000000000 +0800 > +++ sound-2.6/mm/readahead.c =C2=A0 =C2=A02010-03-26 11:52:11.0000000= 00 +0800 > @@ -502,7 +502,7 @@ void page_cache_sync_readahead(struct ad > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return; > > =C2=A0 =C2=A0 =C2=A0 =C2=A0/* be dumb */ > - =C2=A0 =C2=A0 =C2=A0 if (filp->f_mode & FMODE_RANDOM) { > + =C2=A0 =C2=A0 =C2=A0 if (filp && (filp->f_mode & FMODE_RANDOM)) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0force_page_cac= he_readahead(mapping, filp, offset, req_size); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return; > =C2=A0 =C2=A0 =C2=A0 =C2=A0} >