* [PATCH] scsi: efct: Fix potential use-after-free on RQ setup failure
@ 2026-11-12 13:58 Guangshuo Li
2026-12-06 1:48 ` Martin K. Petersen
0 siblings, 1 reply; 2+ messages in thread
From: Guangshuo Li @ 2026-11-12 13:58 UTC (permalink / raw)
To: Ram Vegesna, James E.J. Bottomley, Martin K. Petersen
Cc: linux-scsi, target-devel, linux-kernel
Receive queues are linked to their completion queues before all tracker
allocations succeed. On failure, the RQs are freed but CQ teardown still
walks their list nodes. Publish the RQs only after all allocations succeed.
This issue was found by our static analysis tool under development.
Fixes: e10fc2335980 ("scsi: elx: efct: Hardware queue creation and deletion")
Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
---
drivers/scsi/elx/efct/efct_hw_queues.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/elx/efct/efct_hw_queues.c b/drivers/scsi/elx/efct/efct_hw_queues.c
index 3c27f927f96c..784eadabd3aa 100644
--- a/drivers/scsi/elx/efct/efct_hw_queues.c
+++ b/drivers/scsi/elx/efct/efct_hw_queues.c
@@ -362,15 +362,18 @@ efct_hw_new_rq_set(struct hw_cq *cqs[], struct hw_rq *rqs[],
}
for (i = 0; i < num_rq_pairs; i++) {
- hw->hw_rq[rqs[i]->instance] = rqs[i];
- INIT_LIST_HEAD(&rqs[i]->list_entry);
- list_add_tail(&rqs[i]->list_entry, &cqs[i]->q_list);
size = sizeof(struct efc_hw_sequence *) * rqs[i]->entry_count;
rqs[i]->rq_tracker = kzalloc(size, GFP_KERNEL);
if (!rqs[i]->rq_tracker)
goto error;
}
+ for (i = 0; i < num_rq_pairs; i++) {
+ hw->hw_rq[rqs[i]->instance] = rqs[i];
+ INIT_LIST_HEAD(&rqs[i]->list_entry);
+ list_add_tail(&rqs[i]->list_entry, &cqs[i]->q_list);
+ }
+
return 0;
error:
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] scsi: efct: Fix potential use-after-free on RQ setup failure
2026-11-12 13:58 [PATCH] scsi: efct: Fix potential use-after-free on RQ setup failure Guangshuo Li
@ 2026-12-06 1:48 ` Martin K. Petersen
0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2026-12-06 1:48 UTC (permalink / raw)
To: Guangshuo Li
Cc: Ram Vegesna, James E.J. Bottomley, Martin K. Petersen, linux-scsi,
target-devel, linux-kernel
Guangshuo,
> Receive queues are linked to their completion queues before all tracker
> allocations succeed. On failure, the RQs are freed but CQ teardown still
> walks their list nodes. Publish the RQs only after all allocations succeed.
Applied to 7.5/scsi-staging, thanks!
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-06 1:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12 13:58 [PATCH] scsi: efct: Fix potential use-after-free on RQ setup failure Guangshuo Li
2026-12-06 1:48 ` Martin K. Petersen
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.