public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Luck <tony.luck@intel.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	"Joseph, Jithu" <jithu.joseph@intel.com>,
	markgross@kernel.org, ashok.raj@intel.com,
	ravi.v.shankar@intel.com, linux-kernel@vger.kernel.org,
	platform-driver-x86@vger.kernel.org, patches@lists.linux.dev,
	Tony Luck <tony.luck@intel.com>
Subject: [PATCH 2/2] platform/x86/intel/ifs: return error on load failure
Date: Sun, 10 Jul 2022 11:25:21 -0700	[thread overview]
Message-ID: <20220710182521.60642-3-tony.luck@intel.com> (raw)
In-Reply-To: <20220710182521.60642-1-tony.luck@intel.com>

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


  parent reply	other threads:[~2022-07-10 18:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-08 15:19 [PATCH] platform/x86/intel/ifs: Allow non-default names for IFS image Jithu Joseph
2022-07-08 15:28 ` Greg KH
2022-07-08 18:34   ` Joseph, Jithu
2022-07-10 10:15     ` Greg KH
2022-07-10 13:42       ` Hans de Goede
2022-07-10 13:53         ` Greg KH
2022-07-10 14:08           ` Hans de Goede
2022-07-10 16:04             ` Joseph, Jithu
2022-07-10 16:09               ` Hans de Goede
2022-07-10 18:25             ` [PATCH 0/2] Two fixes for IFS Tony Luck
2022-07-10 18:25               ` [PATCH 1/2] Documentation: Correct IFS reload documentation Tony Luck
2022-07-10 20:00                 ` Greg KH
2022-07-10 18:25               ` Tony Luck [this message]
2022-07-10 19:57               ` [PATCH 0/2] Two fixes for IFS Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220710182521.60642-3-tony.luck@intel.com \
    --to=tony.luck@intel.com \
    --cc=ashok.raj@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=jithu.joseph@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=ravi.v.shankar@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox