>-----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 > >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. > >Signed-off-by: weiping zhang <[email protected]> >--- > drivers/scsi/megaraid/megaraid_sas_base.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c >b/drivers/scsi/megaraid/megaraid_sas_base.c >index b5b9ba7..91eeec9 100644 >--- a/drivers/scsi/megaraid/megaraid_sas_base.c >+++ b/drivers/scsi/megaraid/megaraid_sas_base.c >@@ -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);
Acked-by: Sumit Saxena <[email protected]> >-- >2.9.4

