linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: Borislav Petkov <borislav.petkov@amd.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andreas Herrmann <andreas.herrmann3@amd.com>,
	Kay Sievers <kay.sievers@vrfy.org>, Dave Jones <davej@redhat.com>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	tigran@aivazian.fsnet.co.uk, hpa@zytor.com, x86@kernel.org
Subject: Re: [PATCH 2/2] x86, microcode: Ensure that module is only loaded for
Date: Mon, 16 Apr 2012 14:12:00 +0530	[thread overview]
Message-ID: <4F8BDB58.6070007@linux.vnet.ibm.com> (raw)
In-Reply-To: <20120412163422.GM24549@aftab>

On 04/12/2012 10:04 PM, Borislav Petkov wrote:

> From: Andreas Herrmann <andreas.herrmann3@amd.com>
> Date: Thu, 12 Apr 2012 16:51:57 +0200
> Subject: [PATCH 2/2] x86, microcode: Ensure that module is only loaded for supported AMD CPUs
> 
> Exit early when there's no support for a particular CPU family. Also,
> fixup the "no support for this CPU vendor" to be issued only when the
> driver is attempted to be loaded on an unsupported vendor.
> 
> Cc: stable@vger.kernel.org
> Cc: Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
> Cc: Borislav Petkov <borislav.petkov@amd.com>
> [Boris: added a commit msg because Andreas is lazy]
> Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
> ---


I guess a similar change in intel microcode driver would also be
worthwhile, right? If so, then the below patch might be useful:

----------------->

From: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Subject: x86, microcode: Ensure that module is only loaded on supported Intel CPUs

Exit early when there's no support for a particular CPU family.

Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
---

 arch/x86/kernel/microcode_intel.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/microcode_intel.c b/arch/x86/kernel/microcode_intel.c
index 3ca42d0..0327e2b 100644
--- a/arch/x86/kernel/microcode_intel.c
+++ b/arch/x86/kernel/microcode_intel.c
@@ -147,12 +147,6 @@ static int collect_cpu_info(int cpu_num, struct cpu_signature *csig)
 
 	memset(csig, 0, sizeof(*csig));
 
-	if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 ||
-	    cpu_has(c, X86_FEATURE_IA64)) {
-		pr_err("CPU%d not a capable Intel processor\n", cpu_num);
-		return -1;
-	}
-
 	csig->sig = cpuid_eax(0x00000001);
 
 	if ((c->x86_model >= 5) || (c->x86 > 6)) {
@@ -463,6 +457,14 @@ static struct microcode_ops microcode_intel_ops = {
 
 struct microcode_ops * __init init_intel_microcode(void)
 {
+	struct cpuinfo_x86 *c = &cpu_data(0);
+
+	if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 ||
+	    cpu_has(c, X86_FEATURE_IA64)) {
+		pr_err("Intel CPU family 0x%x not supported\n", c->x86);
+		return NULL;
+	}
+
 	return &microcode_intel_ops;
 }
 



  parent reply	other threads:[~2012-04-16  8:43 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11 16:38 x86, microcode: Conversion from sysdev class caused regression Andreas Herrmann
2012-04-11 17:06 ` Kay Sievers
2012-04-11 20:04   ` Borislav Petkov
2012-04-11 20:06 ` Greg Kroah-Hartman
2012-04-11 20:10   ` Borislav Petkov
2012-04-12 16:23     ` Borislav Petkov
2012-04-12 16:30       ` [PATCH 1/2] x86, microcode: Fix sysfs warning during module unload Borislav Petkov
2012-04-12 22:45         ` Greg Kroah-Hartman
2012-04-12 16:34       ` [PATCH 2/2] x86, microcode: Ensure that module is only loaded for Borislav Petkov
2012-04-12 22:45         ` Greg Kroah-Hartman
2012-04-16  8:42         ` Srivatsa S. Bhat [this message]
2012-04-16 13:43           ` Borislav Petkov
2012-04-17 14:11             ` Srivatsa S. Bhat
2012-04-17 14:50               ` Borislav Petkov
2012-04-17 15:53                 ` Gene Heskett
2012-04-17 16:02                   ` Kay Sievers
2012-04-17 17:30                     ` Gene Heskett
2012-04-17 18:07                       ` Borislav Petkov
2012-04-22  2:55                     ` Henrique de Moraes Holschuh
2012-04-25 23:36                       ` Kay Sievers
2012-04-17 17:35                 ` Srivatsa S. Bhat
2012-05-08  4:28           ` [tip:x86/urgent] x86/microcode: Ensure that module is only loaded on supported Intel CPUs tip-bot for Srivatsa S. Bhat
2012-04-14 18:23 ` [tip:x86/urgent] x86, microcode: Fix sysfs warning during module unload on unsupported CPUs tip-bot for Andreas Herrmann
2012-04-14 18:24 ` [tip:x86/urgent] x86, microcode: Ensure that module is only loaded on supported AMD CPUs tip-bot for Andreas Herrmann

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=4F8BDB58.6070007@linux.vnet.ibm.com \
    --to=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=andreas.herrmann3@amd.com \
    --cc=borislav.petkov@amd.com \
    --cc=davej@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tigran@aivazian.fsnet.co.uk \
    --cc=x86@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).