mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
hfs: return -EPERM for unsupported setattr changes
hfs_inode_setattr() rejects unsupported UID, GID and mode changes, but returns the value stored in error when the filesystem is not mounted with the quiet option. At this point error is zero, as execution has already passed a successful setattr_prepare() call. As a result, unsupported attribute changes are incorrectly reported to userspace as successful even though the inode remains unchanged. Return -EPERM for these operations while preserving the existing behavior for quiet mounts. A chown test on an HFS image reproduces the problem. Without the fix, chown 1234:1234 returns success while ownership remains 0:0. With the fix, the same operation fails with EPERM and ownership remains unchanged. Signed-off-by: Davy Felipe <davyfelipe34@gmail.com> Reviewed-by: Viacheslav Dubeyko <slava@dubeyko.com> Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com> Link: https://lore.kernel.org/r/20260916224016.266800-1-davyfelipe34@gmail.com Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
This commit is contained in:
parent
cee9395acd
commit
2166825899
|
|
@ -663,7 +663,7 @@ int hfs_inode_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
|
|||
((S_ISDIR(inode->i_mode) &&
|
||||
(attr->ia_mode != inode->i_mode)) ||
|
||||
(attr->ia_mode & ~HFS_VALID_MODE_BITS)))) {
|
||||
return hsb->s_quiet ? 0 : error;
|
||||
return hsb->s_quiet ? 0 : -EPERM;
|
||||
}
|
||||
|
||||
/* map file permissions to the closest allowable permissions in HFS */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user