Skip to content

Commit d64d6c5

Browse files
himanshu.madhani@cavium.commartinkpetersen
authored andcommitted
scsi: qla2xxx: Fix NULL pointer crash due to probe failure
This patch fixes regression added by commit d745952 ("scsi: qla2xxx: Add multiple queue pair functionality."). When driver is not able to get reqeusted IRQs from the system, driver will attempt tp clean up memory before failing hardware probe. During this cleanup, driver assigns NULL value to the pointer which has not been allocated by driver yet. This results in a NULL pointer access. Log file will show following message and stack trace qla2xxx [0000:a3:00.1]-00c7:21: MSI-X: Failed to enable support, giving up -- 32/-1. qla2xxx [0000:a3:00.1]-0037:21: Falling back-to MSI mode --1. qla2xxx [0000:a3:00.1]-003a:21: Failed to reserve interrupt 821 already in use. BUG: unable to handle kernel NULL pointer dereference at (null) IP: [<ffffffffc010c4b6>] qla2x00_probe_one+0x18b6/0x2730 [qla2xxx] PGD 0 Oops: 0002 [#1] SMP Fixes: d745952 ("scsi: qla2xxx: Add multiple queue pair functionality."). Cc: <[email protected]> # 4.10 Signed-off-by: Himanshu Madhani <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 4774bc9 commit d64d6c5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/scsi/qla2xxx/qla_os.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3035,9 +3035,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
30353035
base_vha = qla2x00_create_host(sht, ha);
30363036
if (!base_vha) {
30373037
ret = -ENOMEM;
3038-
qla2x00_mem_free(ha);
3039-
qla2x00_free_req_que(ha, req);
3040-
qla2x00_free_rsp_que(ha, rsp);
30413038
goto probe_hw_failed;
30423039
}
30433040

@@ -3098,7 +3095,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
30983095
/* Set up the irqs */
30993096
ret = qla2x00_request_irqs(ha, rsp);
31003097
if (ret)
3101-
goto probe_init_failed;
3098+
goto probe_hw_failed;
31023099

31033100
/* Alloc arrays of request and response ring ptrs */
31043101
if (!qla2x00_alloc_queues(ha, req, rsp)) {
@@ -3415,6 +3412,9 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
34153412
scsi_host_put(base_vha->host);
34163413

34173414
probe_hw_failed:
3415+
qla2x00_mem_free(ha);
3416+
qla2x00_free_req_que(ha, req);
3417+
qla2x00_free_rsp_que(ha, rsp);
34183418
qla2x00_clear_drv_active(ha);
34193419

34203420
iospace_config_failed:

0 commit comments

Comments
 (0)