[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 11 Nov 2022 01:11:45 +0000
From: Catherine Hoang <catherine.hoang@...cle.com>
To: "Darrick J. Wong" <djwong@...nel.org>
CC: "tytso@....edu" <tytso@....edu>,
"linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>
Subject: Re: [PATCH 1/2] ext4: dont return EINVAL from GETFSUUID when
reporting UUID length
> On Nov 10, 2022, at 12:16 PM, Darrick J. Wong <djwong@...nel.org> wrote:
>
> From: Darrick J. Wong <djwong@...nel.org>
>
> If userspace calls this ioctl with fsu_length (the length of the
> fsuuid.fsu_uuid array) set to zero, ext4 copies the desired uuid length
> out to userspace. The kernel call returned a result from a valid input,
> so the return value here should be zero, not EINVAL.
>
> While we're at it, fix the copy_to_user call to make it clear that we're
> only copying out fsu_len.
>
> Signed-off-by: Darrick J. Wong <djwong@...nel.org>
Looks good
Reviewed-by: Catherine Hoang <catherine.hoang@...cle.com>
> ---
> fs/ext4/ioctl.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
>
> diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
> index 95dfea28bf4e..5f91f3ad3e50 100644
> --- a/fs/ext4/ioctl.c
> +++ b/fs/ext4/ioctl.c
> @@ -1153,9 +1153,10 @@ static int ext4_ioctl_getuuid(struct ext4_sb_info *sbi,
>
> if (fsuuid.fsu_len == 0) {
> fsuuid.fsu_len = UUID_SIZE;
> - if (copy_to_user(ufsuuid, &fsuuid, sizeof(fsuuid.fsu_len)))
> + if (copy_to_user(&ufsuuid->fsu_len, &fsuuid.fsu_len,
> + sizeof(fsuuid.fsu_len)))
> return -EFAULT;
> - return -EINVAL;
> + return 0;
> }
>
> if (fsuuid.fsu_len != UUID_SIZE || fsuuid.fsu_flags != 0)
>
Powered by blists - more mailing lists