Skip to content

Commit d3df11e

Browse files
author
Francesco Lavra
committed
setxattr/lsetxattr/fsetxattr: fail on read-only filesystem
These syscalls change the extended attributes in file metadata, and as such should not be allowed on read-only filesystems.
1 parent 488ec03 commit d3df11e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/unix/filesystem.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,8 @@ static sysreturn xattr_check(filesystem fs, const char *name, sstring *name_ss)
655655
static sysreturn setxattr_internal(filesystem fs, tuple n, const char *name,
656656
const void *val, u64 size, int flags)
657657
{
658+
if (fs->ro)
659+
return -EROFS;
658660
sstring attr_name;
659661
sysreturn rv = xattr_check(fs, name, &attr_name);
660662
if (rv)

0 commit comments

Comments
 (0)