FAILED: patch "[PATCH] ext4: don't fail GETFSUUID when the caller provides a long" failed to apply to 4.19-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
Possible dependencies:
a7e9d977e031 ("ext4: don't fail GETFSUUID when the caller provides a long buffer")d95efb14c0b8 ("ext4: add ioctls to get/set the ext4 superblock uuid")bbc605cdb1e1 ("ext4: implement support for get/set fs label")351a0a3fbc35 ("ext4: add ioctl EXT4_IOC_CHECKPOINT")4db5c2e6236f ("ext4: convert to fileattr")7d6beb71da3c ("Merge tag 'idmapped-mounts-v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From a7e9d977e031fceefe1e7cd69ebd7202d5758b56 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <[email protected]>
Date: Thu, 10 Nov 2022 12:16:34 -0800
Subject: [PATCH] ext4: don't fail GETFSUUID when the caller provides a long
buffer
If userspace provides a longer UUID buffer than is required, we shouldn't fail the call with EINVAL -- rather, we can fill the caller's buffer with the bytes we /can/ fill, and update the length field to reflect what we copied. This doesn't break the UAPI since we're enabling a case that currently fails, and so far Ted hasn't released a version of e2fsprogs that uses the new ext4 ioctl.
fs/ext4/ioctl.c +4 -2
@@ -1160,14 +1160,16 @@ static int ext4_ioctl_getuuid(struct ext4_sb_info *sbi,return 0 ; } -if (fsuuid.fsu_len !=UUID_SIZE || fsuuid.fsu_flags !=0 ) +if (fsuuid.fsu_len <UUID_SIZE || fsuuid.fsu_flags !=0 )return -EINVAL ;lock_buffer (sbi->s_sbh);memcpy (uuid, sbi->s_es->s_uuid,UUID_SIZE );unlock_buffer (sbi->s_sbh); -if (copy_to_user (&ufsuuid->fsu_uuid[0 ], uuid,UUID_SIZE )) + fsuuid.fsu_len =UUID_SIZE ; +if (copy_to_user (ufsuuid, &fsuuid,sizeof (fsuuid)) || +copy_to_user (&ufsuuid->fsu_uuid[0 ], uuid,UUID_SIZE ))return -EFAULT ;return 0 ; }