Re: [PATCH v1 4/9] ntfs: return -ERANGE for undersized xattr buffer
From: Hyunchul Lee
Date: Mon Aug 24 2026 - 01:11:21 EST
2026년 8월 21일 (금) 오후 2:33, Baolin Liu <liubaolin12138@xxxxxxx>님이 작성:
>
> From: Baolin Liu <liubaolin@xxxxxxxxxx>
>
> 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: fc053f05ca28 ("ntfs: add reparse and ea operations")
> Signed-off-by: Baolin Liu <liubaolin@xxxxxxxxxx>
Looks good to me.
Reviewed-by: Hyunchul Lee <hyc.lee@xxxxxxxxx>
> ---
> fs/ntfs/ea.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ntfs/ea.c b/fs/ntfs/ea.c
> index 10d5b192f07e..616eb0d65ee3 100644
> --- a/fs/ntfs/ea.c
> +++ b/fs/ntfs/ea.c
> @@ -595,7 +595,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);
> @@ -608,7 +608,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);
> --
> 2.51.0
>
>
--
Thanks,
Hyunchul