diff mbox

[v2] mpt2sas: Abort initialization if no memory I/O resources detected

Message ID 1752241556.3143.1435087724484.JavaMail.zimbra@raptorengineeringinc.com (mailing list archive)
State New, archived
Headers show

Commit Message

Timothy Pearson June 23, 2015, 7:28 p.m. UTC
The mpt2sas driver crashes if the BIOS does not set up at least one
memory I/O resource.  This failure can happen if the device is too
slow to respond during POST and is missed by the BIOS, but Linux
then detects the device later in the boot process.

Signed-off-by: Timothy Pearson <tpearson@raptorengineeringinc.com>
Tested-by: Timothy Pearson <tpearson@raptorengineeringinc.com>
---
 drivers/scsi/mpt2sas/mpt2sas_base.c |    7 +++++++
 1 file changed, 7 insertions(+)

Comments

Timothy Pearson June 28, 2015, 1:30 a.m. UTC | #1
On 06/23/2015 02:28 PM, Timothy Pearson wrote:
> The mpt2sas driver crashes if the BIOS does not set up at least one
> memory I/O resource.  This failure can happen if the device is too
> slow to respond during POST and is missed by the BIOS, but Linux
> then detects the device later in the boot process.
>
> Signed-off-by: Timothy Pearson<tpearson@raptorengineeringinc.com>
> Tested-by: Timothy Pearson<tpearson@raptorengineeringinc.com>
> ---
>   drivers/scsi/mpt2sas/mpt2sas_base.c |    7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
> index 11248de..b70fa5a 100644
> --- a/drivers/scsi/mpt2sas/mpt2sas_base.c
> +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
> @@ -1582,6 +1582,13 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc)
>   		}
>   	}
>
> +	if (ioc->chip == NULL) {
> +		printk(MPT2SAS_ERR_FMT "unable to map "
> +			"adapter memory (resource not found)!\n", ioc->name);
> +		r = -EINVAL;
> +		goto out_fail;
> +	}
> +
>   	_base_mask_interrupts(ioc);
>
>   	r = _base_get_ioc_facts(ioc, CAN_SLEEP);

Just wanted to follow up on this patch since I haven't received a 
response.  As far as I know the (trivial) concerns from the first 
version should be addressed in this version.

Thanks!
Sreekanth Reddy June 28, 2015, 9:41 a.m. UTC | #2
Hi Timothy,

Thanks for the patch.

I feel there is some code redundancy after including this patch, I
mean to say is twice we are checking for (ioc->chip == NULL). So I am
working on to reduce this redundancy. Soon I will post a new patch.

Thanks,
Sreekanth

On Sun, Jun 28, 2015 at 7:00 AM, Timothy Pearson
<tpearson@raptorengineeringinc.com> wrote:
> On 06/23/2015 02:28 PM, Timothy Pearson wrote:
>>
>> The mpt2sas driver crashes if the BIOS does not set up at least one
>> memory I/O resource.  This failure can happen if the device is too
>> slow to respond during POST and is missed by the BIOS, but Linux
>> then detects the device later in the boot process.
>>
>> Signed-off-by: Timothy Pearson<tpearson@raptorengineeringinc.com>
>> Tested-by: Timothy Pearson<tpearson@raptorengineeringinc.com>
>> ---
>>   drivers/scsi/mpt2sas/mpt2sas_base.c |    7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c
>> b/drivers/scsi/mpt2sas/mpt2sas_base.c
>> index 11248de..b70fa5a 100644
>> --- a/drivers/scsi/mpt2sas/mpt2sas_base.c
>> +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
>> @@ -1582,6 +1582,13 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER
>> *ioc)
>>                 }
>>         }
>>
>> +       if (ioc->chip == NULL) {
>> +               printk(MPT2SAS_ERR_FMT "unable to map "
>> +                       "adapter memory (resource not found)!\n",
>> ioc->name);
>> +               r = -EINVAL;
>> +               goto out_fail;
>> +       }
>> +
>>         _base_mask_interrupts(ioc);
>>
>>         r = _base_get_ioc_facts(ioc, CAN_SLEEP);
>
>
> Just wanted to follow up on this patch since I haven't received a response.
> As far as I know the (trivial) concerns from the first version should be
> addressed in this version.
>
> Thanks!
>
> --
> Timothy Pearson
> Raptor Engineering
> +1 (415) 727-8645
> http://www.raptorengineeringinc.com
diff mbox

Patch

diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index 11248de..b70fa5a 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -1582,6 +1582,13 @@  mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc)
 		}
 	}
 
+	if (ioc->chip == NULL) {
+		printk(MPT2SAS_ERR_FMT "unable to map "
+			"adapter memory (resource not found)!\n", ioc->name);
+		r = -EINVAL;
+		goto out_fail;
+	}
+
 	_base_mask_interrupts(ioc);
 
 	r = _base_get_ioc_facts(ioc, CAN_SLEEP);