mirror of
https://github.com/torvalds/linux.git
synced 2026-09-25 09:41:03 +02:00
ntfs: reject unprivileged writes to reserved $LX* xattrs
Reject setxattr of the reserved $LXUID, $LXGID, $LXMOD and $LXDEV names
from userspace unless the caller has CAP_SYS_ADMIN.
Fixes: fc053f05ca ("ntfs: add reparse and ea operations")
Signed-off-by: Pisit Preechapramoth <kml.delusion501@slmail.me>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
parent
19cac7902a
commit
ea6a67ef64
|
|
@ -808,6 +808,12 @@ static int ntfs_new_attr_flags(struct ntfs_inode *ni, __le32 fattr)
|
|||
return err;
|
||||
}
|
||||
|
||||
static bool ntfs_is_reserved_lxattr(const char *name)
|
||||
{
|
||||
return !strcmp(name, "$LXUID") || !strcmp(name, "$LXGID") ||
|
||||
!strcmp(name, "$LXMOD") || !strcmp(name, "$LXDEV");
|
||||
}
|
||||
|
||||
static int ntfs_setxattr(const struct xattr_handler *handler,
|
||||
struct mnt_idmap *idmap, struct dentry *unused,
|
||||
struct inode *inode, const char *name, const void *value,
|
||||
|
|
@ -820,6 +826,9 @@ static int ntfs_setxattr(const struct xattr_handler *handler,
|
|||
if (NVolShutdown(ni->vol))
|
||||
return -EIO;
|
||||
|
||||
if (ntfs_is_reserved_lxattr(name) && !capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
if (!strcmp(name, SYSTEM_DOS_ATTRIB)) {
|
||||
if (sizeof(u8) != size) {
|
||||
err = -EINVAL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user