[PATCH v2 5/9] coresight: syscfg: Take csdev lock when removing owned features

From: James Clark

Date: Wed Nov 04 2026 - 10:48:35 EST


cscfg_remove_owned_csdev_features() modifies csdev->feature_csdev_list
without holding csdev->cscfg_csdev_lock, but other users of the list
like cscfg_csdev_reset_feats() take it. Take the lock in the same way
as cscfg_remove_owned_csdev_configs() already does for the config list.

Fixes: 02bd588e12df ("coresight: configuration: Update API to permit dynamic load/unload")
Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
Closes: https://sashiko.dev/#/bug/linux-6bcce2f2-5aba-40a4-8946-4d843ec84683
Signed-off-by: James Clark <james.clark@xxxxxxxxxx>
---
drivers/hwtracing/coresight/coresight-syscfg.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/hwtracing/coresight/coresight-syscfg.c b/drivers/hwtracing/coresight/coresight-syscfg.c
index 2bfdd7b45e49..8d18cd2aa347 100644
--- a/drivers/hwtracing/coresight/coresight-syscfg.c
+++ b/drivers/hwtracing/coresight/coresight-syscfg.c
@@ -410,6 +410,8 @@ static void cscfg_remove_owned_csdev_features(struct coresight_device *csdev, vo
if (list_empty(&csdev->feature_csdev_list))
return;

+ guard(raw_spinlock_irqsave)(&csdev->cscfg_csdev_lock);
+
list_for_each_entry_safe(feat_csdev, tmp, &csdev->feature_csdev_list, node) {
if (feat_csdev->feat_desc->load_owner == load_owner)
list_del(&feat_csdev->node);

--
2.43.0