xfs
[Top] [All Lists]

Re: [PATCH v2] xfs: avoid underflow in xfs_ioc_trim()

To: Lukáš Czerner <lczerner@xxxxxxxxxx>
Subject: Re: [PATCH v2] xfs: avoid underflow in xfs_ioc_trim()
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Fri, 12 Oct 2012 16:49:27 +1100
Cc: xfs@xxxxxxxxxxx
In-reply-to: <alpine.LFD.2.00.1210120727170.6401@localhost>
References: <1349944432-13776-1-git-send-email-lczerner@xxxxxxxxxx> <20121011213533.GE2739@dastard> <alpine.LFD.2.00.1210120727170.6401@localhost>
User-agent: Mutt/1.5.21 (2010-09-15)
On Fri, Oct 12, 2012 at 07:35:39AM +0200, Lukáš Czerner wrote:
> On Fri, 12 Oct 2012, Dave Chinner wrote:
> 
> > Date: Fri, 12 Oct 2012 08:35:33 +1100
> > From: Dave Chinner <david@xxxxxxxxxxxxx>
> > To: Lukas Czerner <lczerner@xxxxxxxxxx>
> > Cc: xfs@xxxxxxxxxxx
> > Subject: Re: [PATCH v2] xfs: avoid underflow in xfs_ioc_trim()
> > 
> > On Thu, Oct 11, 2012 at 10:33:52AM +0200, Lukas Czerner wrote:
> > > Currently if len argument in xfs_ioc_trim() is smaller than one FSB
> > > the 'end' variable underflow. Avoid that by returning EINVAL when
> > > range is smaller than FSB.
> > > 
> > > Signed-off-by: Lukas Czerner <lczerner@xxxxxxxxxx>
> > 
> > Just a thought - wouldn't this be better done at the VFS so it is
> > consistent across all filesystems? i.e. using inode->i_blkbits?
> > 
> > Cheers,
> > 
> > Dave.
> 
> Currently I am working on patches for other file system, so we'll
> get it fix. Having the check in VFS would require to make FITRIM
> file system (inode?) operation

Not at all - filp->mapping->host gets you the inode....
>
> , or adding cmd specific sections to
> the vfs_ioctl().

But that's a fair reason not to....

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>