Skip to content

Commit e2532b4

Browse files
dougmill-ibmmartinkpetersen
authored andcommitted
scsi: qla2xxx: Fix oops in qla2x00_probe_one error path
On error, kthread_create() returns an errno-encoded pointer, not NULL. The routine qla2x00_probe_one() detects the error case and jumps to probe_failed, but has already assigned the return value from kthread_create() to ha->dpc_thread. Then probe_failed checks to see if ha->dpc_thread is not NULL before doing cleanup on it. Since in the error case this is also not NULL, it ends up trying to access an invalid task pointer. Solution is to assign NULL to ha->dpc_thread in the error path to avoid kthread cleanup in that case. Signed-off-by: Douglas Miller <[email protected]> Acked-by: Himanshu Madhani <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 8fe8ffb commit e2532b4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/scsi/qla2xxx/qla_os.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3212,6 +3212,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
32123212
ql_log(ql_log_fatal, base_vha, 0x00ed,
32133213
"Failed to start DPC thread.\n");
32143214
ret = PTR_ERR(ha->dpc_thread);
3215+
ha->dpc_thread = NULL;
32153216
goto probe_failed;
32163217
}
32173218
ql_dbg(ql_dbg_init, base_vha, 0x00ee,

0 commit comments

Comments
 (0)