Skip to content

Commit

Permalink
Fix error code on __zpl_ioctl_setflags()
Browse files Browse the repository at this point in the history
Other (all?) Linux filesystems seem to return -EPERM instead of -EACCESS
when trying to set FS_APPEND_FL or FS_IMMUTABLE_FL without the
CAP_LINUX_IMMUTABLE capability.  This was detected by generic/545 test
in the fstest suite.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Luis Henriques <henrix@camandro.org>
Closes openzfs#11791
  • Loading branch information
lumigch authored and RageLtMan committed May 31, 2021
1 parent 184cfde commit 5d22b42
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion module/os/linux/zfs/zpl_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ __zpl_ioctl_setflags(struct inode *ip, uint32_t ioctl_flags, xvattr_t *xva)
if ((fchange(ioctl_flags, zfs_flags, FS_IMMUTABLE_FL, ZFS_IMMUTABLE) ||
fchange(ioctl_flags, zfs_flags, FS_APPEND_FL, ZFS_APPENDONLY)) &&
!capable(CAP_LINUX_IMMUTABLE))
return (-EACCES);
return (-EPERM);

if (!zpl_inode_owner_or_capable(kcred->user_ns, ip))
return (-EACCES);
Expand Down

0 comments on commit 5d22b42

Please sign in to comment.