diff options
author | Andrey Albershteyn <aalbersh@redhat.com> | 2025-10-08 14:44:18 +0200 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2025-10-10 13:46:00 +0200 |
commit | d90ad28e8aa482e397150e22f3762173d918a724 (patch) | |
tree | d3e2bf56b7a6b858bcc45ae10e68e28c72565f57 | |
parent | 4dd5b5ac089bb6ea719b7ffb748707ac9cbce4e4 (diff) |
fs: return EOPNOTSUPP from file_setattr/file_getattr syscalls
These syscalls call to vfs_fileattr_get/set functions which return
ENOIOCTLCMD if filesystem doesn't support setting file attribute on an
inode. For syscalls EOPNOTSUPP would be more appropriate return error.
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Christian Brauner <brauner@kernel.org>
-rw-r--r-- | fs/file_attr.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/file_attr.c b/fs/file_attr.c index 460b2dd21a85..1dcec88c0680 100644 --- a/fs/file_attr.c +++ b/fs/file_attr.c @@ -416,6 +416,8 @@ SYSCALL_DEFINE5(file_getattr, int, dfd, const char __user *, filename, } error = vfs_fileattr_get(filepath.dentry, &fa); + if (error == -ENOIOCTLCMD || error == -ENOTTY) + error = -EOPNOTSUPP; if (error) return error; @@ -483,6 +485,8 @@ SYSCALL_DEFINE5(file_setattr, int, dfd, const char __user *, filename, if (!error) { error = vfs_fileattr_set(mnt_idmap(filepath.mnt), filepath.dentry, &fa); + if (error == -ENOIOCTLCMD || error == -ENOTTY) + error = -EOPNOTSUPP; mnt_drop_write(filepath.mnt); } |