From 89cb9bbfcb6cf172b1db57b5f1d76be9da9f0393 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 25 Sep 2026 11:25:57 -0700 Subject: [PATCH] scsi: bnx2i: Enable lock context analysis Document locking requirements with __must_hold(). Add an __assume_ctx_lock() annotation where locking is missing. Signed-off-by: Bart Van Assche Link: https://patch.msgid.link/4cafc1018d9a072df3952488ca0bf4ffb7410be7.1790360262.git.bvanassche@acm.org Signed-off-by: Martin K. Petersen (Oracle) --- drivers/scsi/bnx2i/Makefile | 3 +++ drivers/scsi/bnx2i/bnx2i_hwi.c | 5 +++++ drivers/scsi/bnx2i/bnx2i_iscsi.c | 1 + 3 files changed, 9 insertions(+) diff --git a/drivers/scsi/bnx2i/Makefile b/drivers/scsi/bnx2i/Makefile index 25378671bb1e..2d8e8f0fdd29 100644 --- a/drivers/scsi/bnx2i/Makefile +++ b/drivers/scsi/bnx2i/Makefile @@ -1,4 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only + +CONTEXT_ANALYSIS := y + bnx2i-y := bnx2i_init.o bnx2i_hwi.o bnx2i_iscsi.o bnx2i_sysfs.o obj-$(CONFIG_SCSI_BNX2_ISCSI) += bnx2i.o diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c index 4d4eca23d471..c22f1c981d02 100644 --- a/drivers/scsi/bnx2i/bnx2i_hwi.c +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c @@ -405,6 +405,11 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn, switch (tmfabort_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) { case ISCSI_TM_FUNC_ABORT_TASK: case ISCSI_TM_FUNC_TASK_REASSIGN: + /* + * TODO: hold session->back_lock around the iscsi_itt_to_task() + * call below. + */ + __assume_ctx_lock(&session->back_lock); ctask = iscsi_itt_to_task(session, conn, tmfabort_hdr->rtt); if (!ctask || !ctask->sc) /* diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index 6c80e5b514fd..c868eada72c3 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -1154,6 +1154,7 @@ static void bnx2i_cpy_scsi_cdb(struct scsi_cmnd *sc, struct bnx2i_cmd *cmd) } static void bnx2i_cleanup_task(struct iscsi_task *task) + __must_hold(&task->conn->session->back_lock) { struct iscsi_conn *conn = task->conn; struct bnx2i_conn *bnx2i_conn = conn->dd_data;