[SCSI] isci: Fix NULL ptr dereference when no firmware is being loaded
authorDave Jiang <dave.jiang@intel.com>
Fri, 27 Jan 2012 19:17:37 +0000 (11:17 -0800)
committerJames Bottomley <JBottomley@Parallels.com>
Sat, 18 Feb 2012 14:37:00 +0000 (08:37 -0600)
NULL orom ptr passed in for verification which caused page fault.
We will set a default version when we don't have orom struct.

Reported-by: Dan Melnic <dan@seamicro.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/isci/host.c

index 1a65d6514237dd59ac24c8deb89f1afce27a4e3d..418391b1c3616b07f2976467720565d7e9ee4479 100644 (file)
@@ -1848,9 +1848,11 @@ static enum sci_status sci_oem_parameters_set(struct isci_host *ihost)
        if (state == SCIC_RESET ||
            state == SCIC_INITIALIZING ||
            state == SCIC_INITIALIZED) {
+               u8 oem_version = pci_info->orom ? pci_info->orom->hdr.version :
+                       ISCI_ROM_VER_1_0;
 
                if (sci_oem_parameters_validate(&ihost->oem_parameters,
-                                               pci_info->orom->hdr.version))
+                                               oem_version))
                        return SCI_FAILURE_INVALID_PARAMETER_VALUE;
 
                return SCI_SUCCESS;