From: Guixin Liu Date: Wed, 18 Dec 2024 01:42:14 +0000 (+0800) Subject: scsi: ufs: bsg: Set bsg_queue to NULL after removal X-Git-Tag: v6.14-rc1~80^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1e95c798d8a7f70965f0f88d4657b682ff0ec75f;p=thirdparty%2Fkernel%2Flinux.git scsi: ufs: bsg: Set bsg_queue to NULL after removal 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 Link: https://lore.kernel.org/r/20241218014214.64533-3-kanie@linux.alibaba.com Reviewed-by: Avri Altman Signed-off-by: Martin K. Petersen --- diff --git a/drivers/ufs/core/ufs_bsg.c b/drivers/ufs/core/ufs_bsg.c index 58023f735c195..8d4ad0a3f2cf0 100644 --- a/drivers/ufs/core/ufs_bsg.c +++ b/drivers/ufs/core/ufs_bsg.c @@ -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);