]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
scsi: qla2xxx: Use reinit_completion on mbx_intr_comp
authorTony Battersby <tonyb@cybernetics.com>
Mon, 10 Nov 2025 15:51:28 +0000 (10:51 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jan 2026 12:11:46 +0000 (13:11 +0100)
[ Upstream commit 957aa5974989fba4ae4f807ebcb27f12796edd4d ]

If a mailbox command completes immediately after
wait_for_completion_timeout() times out, ha->mbx_intr_comp could be left
in an inconsistent state, causing the next mailbox command not to wait
for the hardware.  Fix by reinitializing the completion before use.

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Link: https://patch.msgid.link/11b6485e-0bfd-4784-8f99-c06a196dad94@cybernetics.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/qla2xxx/qla_mbx.c

index 8b7c71e779a7816edeaced86cbc3db16ab0e3450..aa6a68e235c9dfc6bb2abba65dcbd1842621cf64 100644 (file)
@@ -249,6 +249,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
        /* Issue set host interrupt command to send cmd out. */
        ha->flags.mbox_int = 0;
        clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags);
+       reinit_completion(&ha->mbx_intr_comp);
 
        /* Unlock mbx registers and wait for interrupt */
        ql_dbg(ql_dbg_mbx, vha, 0x100f,
@@ -275,6 +276,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
                            "cmd=%x Timeout.\n", command);
                        spin_lock_irqsave(&ha->hardware_lock, flags);
                        clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags);
+                       reinit_completion(&ha->mbx_intr_comp);
                        spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
                        if (chip_reset != ha->chip_reset) {