[Iprdd-devel] [PATCH] ipr: Avoid segfault if scsi_dev_data == NULL.
Brought to you by:
brking
|
From: Gabriel K. B. <kr...@li...> - 2016-02-26 21:07:00
|
If there's a device without scsi_dev_data in the list of devices,
iprconfig might segfault when formatting a device for an array. This
prevents this scenario.
Signed-off-by: Gabriel Krisman Bertazi <kr...@li...>
---
iprlib.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/iprlib.c b/iprlib.c
index 09b984f..eb077a5 100644
--- a/iprlib.c
+++ b/iprlib.c
@@ -3709,14 +3709,17 @@ static struct ipr_dev *find_multipath_jbod(struct ipr_dev *dev)
{
struct ipr_ioa *ioa;
struct ipr_dev *multipath_dev;
+ u64 id = dev->scsi_dev_data->device_id;
for_each_sas_ioa(ioa) {
if (ioa == dev->ioa)
continue;
for_each_dev(ioa, multipath_dev) {
- if (dev->scsi_dev_data->device_id == multipath_dev->scsi_dev_data->device_id)
+ if (multipath_dev->scsi_dev_data &&
+ id == multipath_dev->scsi_dev_data->device_id)
return multipath_dev;
+
}
}
--
2.1.0
|