All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: megaraid_sas: Protect megasas_get_ctrl_info() in megasas_resume()
@ 2026-08-28 18:19 Bart Van Assche
  2026-08-28 18:35 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2026-08-28 18:19 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Kashyap Desai, Sumit Saxena,
	Shivasharan S, Chandrakanth patil, James E.J. Bottomley

Protect the megasas_get_ctrl_info() call in megasas_resume() with
instance->reset_mutex using scoped_guard().

megasas_get_ctrl_info() submits a DCMD command and modifies shared
controller information (instance->ctrl_info_buf). Calling it without
holding reset_mutex can race with adapter reset and other DCMD
operations.

Fixes: c3b10a55abc9 ("scsi: megaraid_sas: Update controller info during resume")
Cc: Kashyap Desai <kashyap.desai@broadcom.com>
Cc: Sumit Saxena <sumit.saxena@broadcom.com>
Cc: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Cc: Chandrakanth patil <chandrakanth.patil@broadcom.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index f0152b043e18..f345fb266db0 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -7875,8 +7875,9 @@ megasas_resume(struct device *dev)
 			goto fail_init_mfi;
 	}
 
-	if (megasas_get_ctrl_info(instance) != DCMD_SUCCESS)
-		goto fail_init_mfi;
+	scoped_guard(mutex, &instance->reset_mutex)
+		if (megasas_get_ctrl_info(instance) != DCMD_SUCCESS)
+			goto fail_init_mfi;
 
 	tasklet_init(&instance->isr_tasklet, instance->instancet->tasklet,
 		     (unsigned long)instance);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-28 18:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-28 18:19 [PATCH] scsi: megaraid_sas: Protect megasas_get_ctrl_info() in megasas_resume() Bart Van Assche
2026-08-28 18:35 ` sashiko-bot

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.