* [PATCH 5.15/5.10] scsi: ufs: bsg: Set bsg_queue to NULL after removal
@ 2025-04-16 1:36 Xiangyu Chen
2025-04-16 14:24 ` Sasha Levin
0 siblings, 1 reply; 2+ messages in thread
From: Xiangyu Chen @ 2025-04-16 1:36 UTC (permalink / raw)
To: kanie, avri.altman, martin.petersen; +Cc: zhe.he, stable
From: Guixin Liu <kanie@linux.alibaba.com>
[ Upstream commit 1e95c798d8a7f70965f0f88d4657b682ff0ec75f ]
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>
---
Verified the build test.
---
drivers/scsi/ufs/ufs_bsg.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/scsi/ufs/ufs_bsg.c b/drivers/scsi/ufs/ufs_bsg.c
index 16e8ddcf22fe..b8bbfd81b8ae 100644
--- a/drivers/scsi/ufs/ufs_bsg.c
+++ b/drivers/scsi/ufs/ufs_bsg.c
@@ -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);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 5.15/5.10] scsi: ufs: bsg: Set bsg_queue to NULL after removal
2025-04-16 1:36 [PATCH 5.15/5.10] scsi: ufs: bsg: Set bsg_queue to NULL after removal Xiangyu Chen
@ 2025-04-16 14:24 ` Sasha Levin
0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2025-04-16 14:24 UTC (permalink / raw)
To: stable; +Cc: Xiangyu Chen, Sasha Levin
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected.
No action required from the submitter.
The upstream commit SHA1 provided is correct: 1e95c798d8a7f70965f0f88d4657b682ff0ec75f
WARNING: Author mismatch between patch and upstream commit:
Backport author: Xiangyu Chen<xiangyu.chen@eng.windriver.com>
Commit author: Guixin Liu<kanie@linux.alibaba.com>
Status in newer kernel trees:
6.14.y | Present (exact SHA1)
6.13.y | Present (different SHA1: 9193bdc170cc)
6.12.y | Present (different SHA1: 88a01e9c9ad4)
6.6.y | Present (different SHA1: 5f782d4741bf)
6.1.y | Present (different SHA1: 5e7b6e44468c)
5.15.y | Not found
Note: The patch differs from the upstream commit:
---
1: 1e95c798d8a7f ! 1: be0ecc3eb507b scsi: ufs: bsg: Set bsg_queue to NULL after removal
@@ Metadata
## Commit message ##
scsi: ufs: bsg: Set bsg_queue to NULL after removal
+ [ Upstream commit 1e95c798d8a7f70965f0f88d4657b682ff0ec75f ]
+
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.
@@ Commit message
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>
- ## drivers/ufs/core/ufs_bsg.c ##
-@@ drivers/ufs/core/ufs_bsg.c: void ufs_bsg_remove(struct ufs_hba *hba)
+ ## drivers/scsi/ufs/ufs_bsg.c ##
+@@ drivers/scsi/ufs/ufs_bsg.c: void ufs_bsg_remove(struct ufs_hba *hba)
return;
bsg_remove_queue(hba->bsg_queue);
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-5.10.y | Success | Success |
| stable/linux-5.15.y | Success | Success |
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-16 14:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-16 1:36 [PATCH 5.15/5.10] scsi: ufs: bsg: Set bsg_queue to NULL after removal Xiangyu Chen
2025-04-16 14:24 ` Sasha Levin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.