Skip to content

Commit

Permalink
ovl: support the FS_IOC_FS[SG]ETXATTR ioctls
Browse files Browse the repository at this point in the history
They are the extended version of FS_IOC_FS[SG]ETFLAGS ioctls.
xfs_io -c "chattr <flags>" uses the new ioctls for setting flags.

This used to work in kernel pre v4.19, before stacked file ops
introduced the ovl_ioctl whitelist.

Reported-by: Dave Chinner <david@fromorbit.com>
Fixes: d1d04ef ("ovl: stack file ops")
Cc: <stable@vger.kernel.org> # v4.19
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
  • Loading branch information
Amir Goldstein authored and Miklos Szeredi committed May 27, 2019
1 parent cd6c84d commit b21d9c4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions fs/overlayfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,8 @@ static unsigned int ovl_get_inode_flags(struct inode *inode)
return ovl_iflags;
}

static long ovl_ioctl_set_flags(struct file *file, unsigned long arg)
static long ovl_ioctl_set_flags(struct file *file, unsigned int cmd,
unsigned long arg)
{
long ret;
struct inode *inode = file_inode(file);
Expand Down Expand Up @@ -456,7 +457,7 @@ static long ovl_ioctl_set_flags(struct file *file, unsigned long arg)
if (ret)
goto unlock;

ret = ovl_real_ioctl(file, FS_IOC_SETFLAGS, arg);
ret = ovl_real_ioctl(file, cmd, arg);

ovl_copyflags(ovl_inode_real(inode), inode);
unlock:
Expand All @@ -474,11 +475,13 @@ static long ovl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)

switch (cmd) {
case FS_IOC_GETFLAGS:
case FS_IOC_FSGETXATTR:
ret = ovl_real_ioctl(file, cmd, arg);
break;

case FS_IOC_SETFLAGS:
ret = ovl_ioctl_set_flags(file, arg);
case FS_IOC_FSSETXATTR:
ret = ovl_ioctl_set_flags(file, cmd, arg);
break;

default:
Expand Down

0 comments on commit b21d9c4

Please sign in to comment.