This is a note to let you know that I've just added the patch titled btrfs: fix error pointer dereference in btrfs_ioctl_rm_dev_v2() to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: btrfs-fix-error-pointer-dereference-in-btrfs_ioctl_rm_dev_v2.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From d815b3f2f273537cb8afaf5ab11a46851f6c03e5 Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Date: Tue, 16 Nov 2021 14:50:25 +0300 Subject: btrfs: fix error pointer dereference in btrfs_ioctl_rm_dev_v2() From: Dan Carpenter <dan.carpenter@xxxxxxxxxx> commit d815b3f2f273537cb8afaf5ab11a46851f6c03e5 upstream. If memdup_user() fails the error handing will crash when it tries to kfree() an error pointer. Just return directly because there is no cleanup required. Fixes: 1a15eb724aae ("btrfs: use btrfs_get_dev_args_from_path in dev removal ioctls") Reviewed-by: Josef Bacik <josef@xxxxxxxxxxxxxx> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Reviewed-by: David Sterba <dsterba@xxxxxxxx> Signed-off-by: David Sterba <dsterba@xxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/btrfs/ioctl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -3231,10 +3231,8 @@ static long btrfs_ioctl_rm_dev_v2(struct return -EPERM; vol_args = memdup_user(arg, sizeof(*vol_args)); - if (IS_ERR(vol_args)) { - ret = PTR_ERR(vol_args); - goto out; - } + if (IS_ERR(vol_args)) + return PTR_ERR(vol_args); if (vol_args->flags & ~BTRFS_DEVICE_REMOVE_ARGS_MASK) { ret = -EOPNOTSUPP; Patches currently in stable-queue which might be from dan.carpenter@xxxxxxxxxx are queue-5.15/drm-msm-dp-fix-double-free-on-error-in-msm_dp_bridge.patch queue-5.15/mm-hwpoison-fix-race-between-hugetlb-free-demotion-a.patch queue-5.15/btrfs-fix-error-pointer-dereference-in-btrfs_ioctl_rm_dev_v2.patch