Message ID | 20170807172650.GA33146@bogon.didichuxing.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
>-----Original Message----- >From: weiping zhang [mailto:zhangweiping@didichuxing.com] >Sent: Monday, August 07, 2017 10:57 PM >To: kashyap.desai@broadcom.com; sumit.saxena@broadcom.com; >shivasharan.srikanteshwara@broadcom.com >Cc: megaraidlinux.pdl@broadcom.com; linux-scsi@vger.kernel.org >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 <zhangweiping@didichuxing.com> >--- > 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 <sumit.saxena@broadcom.com> >-- >2.9.4
weiping, > 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. Applied to 4.13/scsi-fixes, thank you!
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);
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 <zhangweiping@didichuxing.com> --- drivers/scsi/megaraid/megaraid_sas_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)