]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
scsi: ufs: bsg: Set bsg_queue to NULL after removal
authorGuixin Liu <kanie@linux.alibaba.com>
Wed, 18 Dec 2024 01:42:14 +0000 (09:42 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 May 2025 05:41:08 +0000 (07:41 +0200)
commit 1e95c798d8a7f70965f0f88d4657b682ff0ec75f upstream.

Currently, this does not cause any issues, but I believe it is necessary to
set bsg_queue to NULL after removing it to prevent potential use-after-free
(UAF) access.

Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Link: https://lore.kernel.org/r/20241218014214.64533-3-kanie@linux.alibaba.com
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
Signed-off-by: He Zhe <zhe.he@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/ufs/ufs_bsg.c

index 05c7347eda18860277acaa54db61849b6cb5f3c6..a7e1b011202bdc54734232a18e778520bf6a8c26 100644 (file)
@@ -175,6 +175,7 @@ void ufs_bsg_remove(struct ufs_hba *hba)
                return;
 
        bsg_remove_queue(hba->bsg_queue);
+       hba->bsg_queue = NULL;
 
        device_del(bsg_dev);
        put_device(bsg_dev);