Message ID | 20240125082254.424859-2-ashok.raj@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-38163-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp1494338dyi; Thu, 25 Jan 2024 00:24:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJX8oPS6uZJjtdIi0hGhQjA4yHj9CQuzZyPq/0fy9p0+ASjG3doYHx9XEosFiUmPzcWbNi X-Received: by 2002:aa7:c610:0:b0:55c:7bb6:f612 with SMTP id h16-20020aa7c610000000b0055c7bb6f612mr804114edq.16.1706171066201; Thu, 25 Jan 2024 00:24:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706171066; cv=pass; d=google.com; s=arc-20160816; b=njKRBbepc54A7Hqixww/qlXHHJSzAKSkkHvYF8N1kGVsBm3LRcSQ3c6ZcxuaPjpRCu Zk2crFwKxkWSVV+yeM7EPNVGbIgRtc7vc9n+nwYD7nV1CH25jWlKPBaFntCkvp4+bB6C guBsO5qxk007EYncH3DcdrURpW/42tqAlNgQ9UqI/QD9FFxHjwHXdWKC+MSElZSdQy8l W2dqBzu+DZdu2/lhv/r23QgcpzQmf54mgZqbs6SG8kaRfJ0Rdpo1a94+JhyWredveh4C LEqTmWj2eKsmB8BOq2YV8WgjdI/u6zcVY9RrxfZTeQp6/sLqXb3DCJjxbxNKuhqUbRhY QAeQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=rs7minHQy9e3ARRNo/WWFOOtGkzR64yS3/vaWsEQXKw=; fh=HGGG/1ZnllhGg8mR63R415U7MpyKO3cAiKMrQ/+oMGU=; b=ghcCdKX4Batj+wj1EaD5EcrkbuJ6DgpuGsT0iMSoMMdCyx/DpaltLMcat39O31WwRp Db5EB+O/qk2pGp5t3zb5sViTmBAyCMRihzztHXNw6KJFfR3rYwVrrknkewnlhp7eRsS+ foxYbhYK9ZOxQGISu3405fR8eLNurXI77IZw6JlBSDFshNuNMYR2aVnrDIWCGaMaYawH A09cnkD5Jk4S9S0z1/U7Y15tkJvnfAitAK40pDiFA3OXkP9nCSGHslMttRhe5LeFUZNn y+3dXKBIveCx7Bw1TUOFldquu5gbVx/HrMc59BbVT4SwlpG3gltlGnEXA7sJ3Gl9+RVI Wz7A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="gV/1sJ9D"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-38163-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38163-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id i34-20020a0564020f2200b0055a47d6a782si7407155eda.27.2024.01.25.00.24.26 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 00:24:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38163-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="gV/1sJ9D"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-38163-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38163-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CE2771F21F9F for <ouuuleilei@gmail.com>; Thu, 25 Jan 2024 08:24:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3EB491B59B; Thu, 25 Jan 2024 08:23:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gV/1sJ9D" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 88B2B1798E; Thu, 25 Jan 2024 08:23:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706171006; cv=none; b=uQRJP3y7tOcbHWaPU+vlsrAuZRcHsg6NNFjMzTiDRdeT+hnuuyM2bc+5qimNM+aN2bQK1N2EUw7F47+uQ+luc1ZOAy1LK70msWn9E9YMFUSd7kqcbR3gVEzf8bAhci22tVf3VC7nnEn0LNni5IPfN1o1RnQAVDI6/qlP30K5P6A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706171006; c=relaxed/simple; bh=if8v2kup1nIzoficv1uxi7vRkXghvMvZw9xTx9Js46E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=c7I/2VOgmPQQAc2exxbdIwG3V5ozJcQKHeRy9QqGBRoleRXLtrFwH84lvIoxWRT/+TxDo+gLxnfFp0nKi4QDbvnJmUcAmrGpjpkvyivztnEU35Ct/OhqrOUn5rwPkYwMMFlHuATewytWNL6Z/9k1otFvNEhmiMEa1pOL7/Ckub8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=gV/1sJ9D; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706171005; x=1737707005; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=if8v2kup1nIzoficv1uxi7vRkXghvMvZw9xTx9Js46E=; b=gV/1sJ9Dc8ZKNJEko/Vz2q+3vaOnmbE036MJS20VQW33i2XnwrB7pNzI QhCgPsm4x1sgv/bNNga61p7ofkDJY1xWs66mAebj+QNVaD90/pmVTEBba 0yxP9+VmD4x92ZEP3e/WoQBDOajWwkIQ1sx/JoSur7iJQ0n/o+kfqJH+1 AXN/anS4+Es0u4Y2FALmkYLD2t9I/G0Tcp3tSBC5iMzWzDYCKH+nCw/WO jqNLEtlo1X3iAZs+B/ybQj38odvC401xiZCsTN8kQ65oE2di2aFhwZMyF 0q2J6R7mcUVFKWyuwX7ow8QPYEqmiQi2kNY7N0bGWRz0UapHimY6PzzfC g==; X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="1987169" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="1987169" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2024 00:23:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="876975923" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="876975923" Received: from araj-ucode.jf.intel.com ([10.23.0.11]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2024 00:23:22 -0800 From: Ashok Raj <ashok.raj@intel.com> To: Hans de Goede <hdegoede@redhat.com>, Ilpo Jarvinen <ilpo.jarvinen@linux.intel.com>, markgross@kernel.org Cc: Jithu Joseph <jithu.joseph@intel.com>, rostedt@goodmis.org, ashok.raj@intel.com, tony.luck@intel.com, LKML <linux-kernel@vger.kernel.org>, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, pengfei.xu@intel.com Subject: [PATCH 1/5] platform/x86/intel/ifs: Call release_firmware() when handling errors. Date: Thu, 25 Jan 2024 00:22:50 -0800 Message-Id: <20240125082254.424859-2-ashok.raj@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240125082254.424859-1-ashok.raj@intel.com> References: <20240125082254.424859-1-ashok.raj@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789050031660259092 X-GMAIL-MSGID: 1789050031660259092 |
Series |
Miscelleanous fixes and improvements to Infield Scan
|
|
Commit Message
Ashok Raj
Jan. 25, 2024, 8:22 a.m. UTC
From: Jithu Joseph <jithu.joseph@intel.com> Missing release_firmware() due to error handling blocked any future image loading. Fix the return code and release_fiwmare() to release the bad image. Fixes: 25a76dbb36dd ("platform/x86/intel/ifs: Validate image size") Reported-by: Pengfei Xu <pengfei.xu@intel.com> Signed-off-by: Jithu Joseph <jithu.joseph@intel.com> Signed-off-by: Ashok Raj <ashok.raj@intel.com> Tested-by: Pengfei Xu <pengfei.xu@intel.com> Reviewed-by: Tony Luck <tony.luck@intel.com> --- drivers/platform/x86/intel/ifs/load.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On Thu, 25 Jan 2024, Ashok Raj wrote: > From: Jithu Joseph <jithu.joseph@intel.com> > > Missing release_firmware() due to error handling blocked any future image > loading. > > Fix the return code and release_fiwmare() to release the bad image. > > Fixes: 25a76dbb36dd ("platform/x86/intel/ifs: Validate image size") > Reported-by: Pengfei Xu <pengfei.xu@intel.com> > Signed-off-by: Jithu Joseph <jithu.joseph@intel.com> > Signed-off-by: Ashok Raj <ashok.raj@intel.com> > Tested-by: Pengfei Xu <pengfei.xu@intel.com> > Reviewed-by: Tony Luck <tony.luck@intel.com> > --- > drivers/platform/x86/intel/ifs/load.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c > index a1ee1a74fc3c..2cf3b4a8813f 100644 > --- a/drivers/platform/x86/intel/ifs/load.c > +++ b/drivers/platform/x86/intel/ifs/load.c > @@ -399,7 +399,8 @@ int ifs_load_firmware(struct device *dev) > if (fw->size != expected_size) { > dev_err(dev, "File size mismatch (expected %u, actual %zu). Corrupted IFS image.\n", > expected_size, fw->size); > - return -EINVAL; > + ret = -EINVAL; > + goto release; > } > > ret = image_sanity_check(dev, (struct microcode_header_intel *)fw->data); > Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Hi, On 1/25/24 09:22, Ashok Raj wrote: > From: Jithu Joseph <jithu.joseph@intel.com> > > Missing release_firmware() due to error handling blocked any future image > loading. > > Fix the return code and release_fiwmare() to release the bad image. > > Fixes: 25a76dbb36dd ("platform/x86/intel/ifs: Validate image size") > Reported-by: Pengfei Xu <pengfei.xu@intel.com> > Signed-off-by: Jithu Joseph <jithu.joseph@intel.com> > Signed-off-by: Ashok Raj <ashok.raj@intel.com> > Tested-by: Pengfei Xu <pengfei.xu@intel.com> > Reviewed-by: Tony Luck <tony.luck@intel.com> Thank you for your patch/series, I've applied this patch (series) to my review-hans branch: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans Note it will show up in the pdx86 review-hans branch once I've pushed my local branch there, which might take a while. I will include this patch in my next fixes pull-req to Linus for the current kernel development cycle. Regards, Hans > --- > drivers/platform/x86/intel/ifs/load.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c > index a1ee1a74fc3c..2cf3b4a8813f 100644 > --- a/drivers/platform/x86/intel/ifs/load.c > +++ b/drivers/platform/x86/intel/ifs/load.c > @@ -399,7 +399,8 @@ int ifs_load_firmware(struct device *dev) > if (fw->size != expected_size) { > dev_err(dev, "File size mismatch (expected %u, actual %zu). Corrupted IFS image.\n", > expected_size, fw->size); > - return -EINVAL; > + ret = -EINVAL; > + goto release; > } > > ret = image_sanity_check(dev, (struct microcode_header_intel *)fw->data);
On 2024-01-26 at 20:15:46 +0100, Hans de Goede wrote: > Hi, > > On 1/25/24 09:22, Ashok Raj wrote: > > From: Jithu Joseph <jithu.joseph@intel.com> > > > > Missing release_firmware() due to error handling blocked any future image > > loading. > > > > Fix the return code and release_fiwmare() to release the bad image. > > > > Fixes: 25a76dbb36dd ("platform/x86/intel/ifs: Validate image size") > > Reported-by: Pengfei Xu <pengfei.xu@intel.com> > > Signed-off-by: Jithu Joseph <jithu.joseph@intel.com> > > Signed-off-by: Ashok Raj <ashok.raj@intel.com> > > Tested-by: Pengfei Xu <pengfei.xu@intel.com> > > Reviewed-by: Tony Luck <tony.luck@intel.com> > > Thank you for your patch/series, I've applied this patch > (series) to my review-hans branch: > https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans > > Note it will show up in the pdx86 review-hans branch once I've > pushed my local branch there, which might take a while. > > I will include this patch in my next fixes pull-req to Linus > for the current kernel development cycle. > FYR. [ CC stable@vger.kernel.org ] Missed CC: Stable Tag. This (follow-up) patch is now upstream into v6.7-rc1: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=25a76dbb36dd Looks like linux-6.7.y needs the above fixed patch too. Best Regards, Thanks! > Regards, > > Hans > > > > > > --- > > drivers/platform/x86/intel/ifs/load.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c > > index a1ee1a74fc3c..2cf3b4a8813f 100644 > > --- a/drivers/platform/x86/intel/ifs/load.c > > +++ b/drivers/platform/x86/intel/ifs/load.c > > @@ -399,7 +399,8 @@ int ifs_load_firmware(struct device *dev) > > if (fw->size != expected_size) { > > dev_err(dev, "File size mismatch (expected %u, actual %zu). Corrupted IFS image.\n", > > expected_size, fw->size); > > - return -EINVAL; > > + ret = -EINVAL; > > + goto release; > > } > > > > ret = image_sanity_check(dev, (struct microcode_header_intel *)fw->data); >
Hi, On 1/29/24 04:55, Pengfei Xu wrote: > On 2024-01-26 at 20:15:46 +0100, Hans de Goede wrote: >> Hi, >> >> On 1/25/24 09:22, Ashok Raj wrote: >>> From: Jithu Joseph <jithu.joseph@intel.com> >>> >>> Missing release_firmware() due to error handling blocked any future image >>> loading. >>> >>> Fix the return code and release_fiwmare() to release the bad image. >>> >>> Fixes: 25a76dbb36dd ("platform/x86/intel/ifs: Validate image size") >>> Reported-by: Pengfei Xu <pengfei.xu@intel.com> >>> Signed-off-by: Jithu Joseph <jithu.joseph@intel.com> >>> Signed-off-by: Ashok Raj <ashok.raj@intel.com> >>> Tested-by: Pengfei Xu <pengfei.xu@intel.com> >>> Reviewed-by: Tony Luck <tony.luck@intel.com> >> >> Thank you for your patch/series, I've applied this patch >> (series) to my review-hans branch: >> https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans >> >> Note it will show up in the pdx86 review-hans branch once I've >> pushed my local branch there, which might take a while. >> >> I will include this patch in my next fixes pull-req to Linus >> for the current kernel development cycle. >> > > FYR. > > [ CC stable@vger.kernel.org ] > Missed CC: Stable Tag. > > This (follow-up) patch is now upstream into v6.7-rc1: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=25a76dbb36dd > > Looks like linux-6.7.y needs the above fixed patch too. If you want to see this patch in the stable series please submit it, with a reference to the upstream commit, to stable@vger.kernel.org yourself. Regards, Hans >>> --- >>> drivers/platform/x86/intel/ifs/load.c | 3 ++- >>> 1 file changed, 2 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c >>> index a1ee1a74fc3c..2cf3b4a8813f 100644 >>> --- a/drivers/platform/x86/intel/ifs/load.c >>> +++ b/drivers/platform/x86/intel/ifs/load.c >>> @@ -399,7 +399,8 @@ int ifs_load_firmware(struct device *dev) >>> if (fw->size != expected_size) { >>> dev_err(dev, "File size mismatch (expected %u, actual %zu). Corrupted IFS image.\n", >>> expected_size, fw->size); >>> - return -EINVAL; >>> + ret = -EINVAL; >>> + goto release; >>> } >>> >>> ret = image_sanity_check(dev, (struct microcode_header_intel *)fw->data); >> >
diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c index a1ee1a74fc3c..2cf3b4a8813f 100644 --- a/drivers/platform/x86/intel/ifs/load.c +++ b/drivers/platform/x86/intel/ifs/load.c @@ -399,7 +399,8 @@ int ifs_load_firmware(struct device *dev) if (fw->size != expected_size) { dev_err(dev, "File size mismatch (expected %u, actual %zu). Corrupted IFS image.\n", expected_size, fw->size); - return -EINVAL; + ret = -EINVAL; + goto release; } ret = image_sanity_check(dev, (struct microcode_header_intel *)fw->data);