diff mbox series

[2/2] platform/x86/intel/ifs: return error on load failure

Message ID 20220710182521.60642-3-tony.luck@intel.com (mailing list archive)
State Changes Requested, archived
Headers show
Series Two fixes for IFS | expand

Commit Message

Luck, Tony July 10, 2022, 6:25 p.m. UTC
From: Jithu Joseph <jithu.joseph@intel.com>

A bug in ifs_load_firmware() error path will make it return
SUCCESS in the event of failure.

If ifs_image_sanity_check() fails, then "ret" is still zero (from
the earlier successful call to request_firmware_direct().

Reinitialize the return variable with appropriate error code.

Fixes: 684ec215706d4 ("platform/x86/intel/ifs: Authenticate and copy to secured memory")
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
---
 drivers/platform/x86/intel/ifs/load.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c
index d056617ddc85..3edcc570f1fe 100644
--- a/drivers/platform/x86/intel/ifs/load.c
+++ b/drivers/platform/x86/intel/ifs/load.c
@@ -252,6 +252,7 @@  void ifs_load_firmware(struct device *dev)
 
 	if (!ifs_image_sanity_check(dev, (struct microcode_header_intel *)fw->data)) {
 		dev_err(dev, "ifs header sanity check failed\n");
+		ret = -EINVAL;
 		goto release;
 	}