Skip to content

Commit d90ad28

Browse files
alberandbrauner
authored andcommitted
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 <[email protected]> Reviewed-by: Jan Kara <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 4dd5b5a commit d90ad28

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/file_attr.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,8 @@ SYSCALL_DEFINE5(file_getattr, int, dfd, const char __user *, filename,
416416
}
417417

418418
error = vfs_fileattr_get(filepath.dentry, &fa);
419+
if (error == -ENOIOCTLCMD || error == -ENOTTY)
420+
error = -EOPNOTSUPP;
419421
if (error)
420422
return error;
421423

@@ -483,6 +485,8 @@ SYSCALL_DEFINE5(file_setattr, int, dfd, const char __user *, filename,
483485
if (!error) {
484486
error = vfs_fileattr_set(mnt_idmap(filepath.mnt),
485487
filepath.dentry, &fa);
488+
if (error == -ENOIOCTLCMD || error == -ENOTTY)
489+
error = -EOPNOTSUPP;
486490
mnt_drop_write(filepath.mnt);
487491
}
488492

0 commit comments

Comments
 (0)