scsi: megaraid_sas: fix error handle in megasas_probe_one
Subsystems (2)
PATCH 1/1 scsi: megaraid_sas: fix error handle in megasas_probe_one
megasas_mgmt_info.max_index has increased by 1 before megasas_io_attach, if megasas_io_attach return error, then goto fail_io_attach, megasas_mgmt_info.instance has a wrong index here. So first reduce max_index and then set that instance to NULL.
--- drivers/scsi/megaraid/megaraid_sas_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/megaraid/megaraid_sas_base.c +1 -1
@@ -6226,8 +6226,8 @@ static int megasas_probe_one(struct pci_dev *pdev, fail_start_aen: fail_io_attach: megasas_mgmt_info.count--; - megasas_mgmt_info.instance[megasas_mgmt_info.max_index] =NULL ; megasas_mgmt_info.max_index--; + megasas_mgmt_info.instance[megasas_mgmt_info.max_index] =NULL ; instance->instancet->disable_intr (instance);megasas_destroy_irqs (instance);
Signature · 1 line
2.9.4
Quoted 7 lines
-----Original Message-----
From: weiping zhang [mailto:[email protected]]
Sent: Monday, August 07, 2017 10:57 PM
To: [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: [PATCH] scsi:megaraid_sas: fix error handle in
megasas_probe_one
Quoted 4 lines
megasas_mgmt_info.max_index has increased by 1 before
megasas_io_attach, ifmegasas_io_attachreturn error, then gotofail_io_attach, megasas_mgmt_info.instance has a wrong index here. So
first
Quoted 22 lines
reduce
max_indexand then set that instance to NULL.Signed-off-by weiping zhang <[email protected]>---
drivers/scsi/megaraid/megaraid_sas_base.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/megaraid/megaraid_sas_base.c +0
-0@@ -6226,8 +6226,8 @@ static int megasas_probe_one(struct pci_dev *pdev,
fail_start_aen:fail_io_attach:megasas_mgmt_info.count--;drivers/scsi/megaraid/megaraid_sas_base.c +0
-1- megasas_mgmt_info.instance[megasas_mgmt_info.max_index] =NULL; megasas_mgmt_info.max_index--;drivers/scsi/megaraid/megaraid_sas_base.c +1
-0+ megasas_mgmt_info.instance[megasas_mgmt_info.max_index] =NULL;
Quoted 2 lines
instance->instancet->disable_intr(instance); megasas_destroy_irqs(instance);
Quoted 2 lines
--
2.9.4
Martin K. Petersen
Appliedweiping,
Quoted 4 lines
megasas_mgmt_info.max_index has increased by 1 before
megasas_io_attach, ifmegasas_io_attachreturn error, then gotofail_io_attach, megasas_mgmt_info.instance has a wrong index here. So first reducemax_indexand then set that instance to NULL.
Applied to 4.13/scsi-fixes, thank you!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering