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

From: Tony Luck
Date: Sun Jul 10 2022 - 14:25:34 EST


From: Jithu Joseph <jithu.joseph@xxxxxxxxx>

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@xxxxxxxxx>
Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
---
drivers/platform/x86/intel/ifs/load.c | 1 +
1 file changed, 1 insertion(+)

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;
}

--
2.35.3