[PATCH] r/o bind mounts: elevate write count for ioctls()
Some ioctl()s can cause writes to the filesystem. Take these, and make them use mnt_want/drop_write() instead. [AV: updated] Acked-by: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Hansen <haveblue@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -60,10 +60,6 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags,
|
||||
goto bail;
|
||||
}
|
||||
|
||||
status = -EROFS;
|
||||
if (IS_RDONLY(inode))
|
||||
goto bail_unlock;
|
||||
|
||||
status = -EACCES;
|
||||
if (!is_owner_or_cap(inode))
|
||||
goto bail_unlock;
|
||||
@@ -134,8 +130,13 @@ long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
if (get_user(flags, (int __user *) arg))
|
||||
return -EFAULT;
|
||||
|
||||
return ocfs2_set_inode_attr(inode, flags,
|
||||
status = mnt_want_write(filp->f_path.mnt);
|
||||
if (status)
|
||||
return status;
|
||||
status = ocfs2_set_inode_attr(inode, flags,
|
||||
OCFS2_FL_MODIFIABLE);
|
||||
mnt_drop_write(filp->f_path.mnt);
|
||||
return status;
|
||||
case OCFS2_IOC_RESVSP:
|
||||
case OCFS2_IOC_RESVSP64:
|
||||
case OCFS2_IOC_UNRESVSP:
|
||||
|
Reference in New Issue
Block a user