Skip to content

Commit 3cb182b

Browse files
rrosattimartinkpetersen
authored andcommitted
scsi: qla2xxx: Fix crash on qla2x00_mailbox_command
This patch fixes a crash on qla2x00_mailbox_command caused when the driver is on UNLOADING state and tries to call qla2x00_poll, which triggers a NULL pointer dereference. Signed-off-by: Rodrigo R. Galvao <[email protected]> Signed-off-by: Mauro S. M. Rodrigues <[email protected]> Acked-by: Himanshu Madhani <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent e73c864 commit 3cb182b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/scsi/qla2xxx/qla_mbx.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,14 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
292292
if (time_after(jiffies, wait_time))
293293
break;
294294

295+
/*
296+
* Check if it's UNLOADING, cause we cannot poll in
297+
* this case, or else a NULL pointer dereference
298+
* is triggered.
299+
*/
300+
if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags)))
301+
return QLA_FUNCTION_TIMEOUT;
302+
295303
/* Check for pending interrupts. */
296304
qla2x00_poll(ha->rsp_q_map[0]);
297305

0 commit comments

Comments
 (0)