]> git.ipfire.org Git - thirdparty/kernel/linux.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)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 10 Jan 2025 23:03:35 +0000 (18:03 -0500)
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>
drivers/ufs/core/ufs_bsg.c

index 58023f735c195fa60137192f37c23a90ca51c418..8d4ad0a3f2cf02257c30be7220f3966bd1182a87 100644 (file)
@@ -216,6 +216,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);