mirror of
https://github.com/torvalds/linux.git
synced 2026-09-11 20:13:02 +02:00
ntfs: return -ERANGE for undersized xattr buffer
When the value buffer passed to getxattr(2) for system.dos_attrib,
system.ntfs_attrib or system.ntfs_attrib_be is smaller than the
attribute value, ntfs_getxattr() returns -ENODATA, which tells
userspace the attribute does not exist. The xattr API expects
-ERANGE in this case, and ntfs_get_ea() in the same file already
returns -ERANGE for regular EAs.
Fixes: fc053f05ca ("ntfs: add reparse and ea operations")
Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
parent
9692b1b4fc
commit
ada7288019
|
|
@ -615,7 +615,7 @@ static int ntfs_getxattr(const struct xattr_handler *handler,
|
|||
if (!buffer) {
|
||||
err = sizeof(u8);
|
||||
} else if (size < sizeof(u8)) {
|
||||
err = -ENODATA;
|
||||
err = -ERANGE;
|
||||
} else {
|
||||
err = sizeof(u8);
|
||||
*(u8 *)buffer = (u8)(le32_to_cpu(ni->flags) & 0x3F);
|
||||
|
|
@ -628,7 +628,7 @@ static int ntfs_getxattr(const struct xattr_handler *handler,
|
|||
if (!buffer) {
|
||||
err = sizeof(u32);
|
||||
} else if (size < sizeof(u32)) {
|
||||
err = -ENODATA;
|
||||
err = -ERANGE;
|
||||
} else {
|
||||
err = sizeof(u32);
|
||||
*(u32 *)buffer = le32_to_cpu(ni->flags);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user