Bug#770492: [RFC PATCH RESEND] vfs: Move security_inode_killpriv() after permission checks

2015-06-03 Thread Mateusz Guzik
On Mon, Apr 13, 2015 at 11:39:01AM +1000, James Morris wrote: > On Wed, 8 Apr 2015, Mateusz Guzik wrote: > > > This is still a problem. Any feedback about the patch? > > > > I'd like to see feedback from vfs folk (Al). > Ping? Are there any concerns with the pa

Bug#770492: [RFC PATCH RESEND] vfs: Move security_inode_killpriv() after permission checks

2015-04-08 Thread Mateusz Guzik
; > if (iattr->ia_valid & ATTR_SIZE) { > xfs_ilock(ip, XFS_IOLOCK_EXCL); > - error = xfs_setattr_size(ip, iattr); > + error = xfs_setattr_size(dentry, ip, iattr); > xfs_iunlock(ip, XFS_IOLOCK_EXCL); > } else { > - error = xfs_setattr_nonsize(ip, iattr, 0); > + error = xfs_setattr_nonsize(dentry, ip, iattr, 0); > } > > return error; > diff --git a/fs/xfs/xfs_iops.h b/fs/xfs/xfs_iops.h > index 1c34e43..6994d3e 100644 > --- a/fs/xfs/xfs_iops.h > +++ b/fs/xfs/xfs_iops.h > @@ -32,8 +32,14 @@ extern void xfs_setup_inode(struct xfs_inode *); > */ > #define XFS_ATTR_NOACL 0x01/* Don't call posix_acl_chmod */ > > -extern int xfs_setattr_nonsize(struct xfs_inode *ip, struct iattr *vap, > +/* > + * XXX Several callers have to pass dentry = NULL and this should > + * work but it's really ugly. > + */ > +extern int xfs_setattr_nonsize(struct dentry *dentry, > +struct xfs_inode *ip, struct iattr *vap, > int flags); > -extern int xfs_setattr_size(struct xfs_inode *ip, struct iattr *vap); > +extern int xfs_setattr_size(struct dentry *dentry, > + struct xfs_inode *ip, struct iattr *vap); > > #endif /* __XFS_IOPS_H__ */ > diff --git a/include/linux/fs.h b/include/linux/fs.h > index 9ab779e..7cad5d1 100644 > --- a/include/linux/fs.h > +++ b/include/linux/fs.h > @@ -2663,6 +2663,7 @@ extern int buffer_migrate_page(struct address_space *, > extern int inode_change_ok(const struct inode *, struct iattr *); > extern int inode_newsize_ok(const struct inode *, loff_t offset); > extern void setattr_copy(struct inode *inode, const struct iattr *attr); > +extern int setattr_killpriv(struct dentry *dentry, struct iattr *attr); > > extern int file_update_time(struct file *file); > > diff --git a/mm/shmem.c b/mm/shmem.c > index 185836b..d1d4b9b 100644 > --- a/mm/shmem.c > +++ b/mm/shmem.c > @@ -557,6 +557,10 @@ static int shmem_setattr(struct dentry *dentry, struct > iattr *attr) > if (error) > return error; > > + error = setattr_killpriv(dentry, attr); > + if (error) > + return error; > + > if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE)) { > loff_t oldsize = inode->i_size; > loff_t newsize = attr->ia_size; > > > -- > Ben Hutchings > The first rule of tautology club is the first rule of tautology club. -- Mateusz Guzik -- To UNSUBSCRIBE, email to debian-kernel-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20150408214327.GA13796@mguzik