isci: validate oem parameters early, and fallback
If the platform specifies invalid parameters warn the user and fallback to
internal defaults rather than fail the driver load altogether.
Reported-by: Yinghai Lu <yinghai.lu@oracle.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index 5da9a69..015ce94 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -489,6 +489,16 @@
else
orom = isci_request_oprom(pdev);
+ for (i = 0; orom && i < ARRAY_SIZE(orom->ctrl); i++) {
+ if (scic_oem_parameters_validate(&orom->ctrl[i])) {
+ dev_warn(&pdev->dev,
+ "[%d]: invalid oem parameters detected, falling back to firmware\n", i);
+ devm_kfree(&pdev->dev, orom);
+ orom = NULL;
+ break;
+ }
+ }
+
if (!orom) {
source = "(firmware)";
orom = isci_request_firmware(pdev, fw);