linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: megaraid_sas: fix error handle in megasas_probe_one
@ 2017-08-07 17:26 weiping zhang
  2017-08-07 17:44 ` Sumit Saxena
  2017-08-08  1:55 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: weiping zhang @ 2017-08-07 17:26 UTC (permalink / raw)
  To: kashyap.desai, sumit.saxena, shivasharan.srikanteshwara
  Cc: megaraidlinux.pdl, linux-scsi

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);
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] scsi: megaraid_sas: fix error handle in megasas_probe_one
  2017-08-07 17:26 [PATCH] scsi: megaraid_sas: fix error handle in megasas_probe_one weiping zhang
@ 2017-08-07 17:44 ` Sumit Saxena
  2017-08-08  1:55 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Sumit Saxena @ 2017-08-07 17:44 UTC (permalink / raw)
  To: weiping zhang, Kashyap Desai, Shivasharan Srikanteshwara
  Cc: PDL,MEGARAIDLINUX, linux-scsi

>-----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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: megaraid_sas: fix error handle in megasas_probe_one
  2017-08-07 17:26 [PATCH] scsi: megaraid_sas: fix error handle in megasas_probe_one weiping zhang
  2017-08-07 17:44 ` Sumit Saxena
@ 2017-08-08  1:55 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2017-08-08  1:55 UTC (permalink / raw)
  To: weiping zhang
  Cc: kashyap.desai, sumit.saxena, shivasharan.srikanteshwara,
	megaraidlinux.pdl, linux-scsi


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!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-08  1:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-07 17:26 [PATCH] scsi: megaraid_sas: fix error handle in megasas_probe_one weiping zhang
2017-08-07 17:44 ` Sumit Saxena
2017-08-08  1:55 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).