Re: [PATCH] xfs: fix buffer use after free on IO error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 25, 2014 at 06:17:05AM -0700, Christoph Hellwig wrote:
> > On Fri, Mar 21, 2014 at 09:48:50PM -0500, Eric Sandeen wrote:
> > > +	/*
> > > +	 * If _xfs_buf_ioapply failed, we'll get back here with
> > > +	 * only the reference we took above.  _xfs_buf_ioend will
> > > +	 * drop it to zero, so we'd better not queue it for later,
> > > +	 * or we'll free it before it's done.
> > > +	 */
> > > +	_xfs_buf_ioend(bp, bp->b_error ? 0 : 1);
> > >  
> > 
> > Out of curiosity, is there any major reason we don't use 0 here
> > unconditionally? Are we worried about I/O completing before we have a
> > chance to decrement the reference?
> 
> I think this should unconditionally avoid the schedule, and while we're
> at it we should kill _xfs_buf_ioend and opencode it here and at the
> other callsite.

I thought we schduled here because we can issue IO from IO
completion and so we need to requeue the IO completion rather than
run it inline in the current IO completion that hasn't fully
completed it's processing yet..

> Also atomic_dec_and_test really just returns true/false - there should
> ne no need for the explicit == 1 in the conditional.

Right, there's several other cleanups around this code that can be
done as Eric has mentioned...

Cheers,

Dave.

-- 
Dave Chinner
david@xxxxxxxxxxxxx

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux