Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753316AbYHSWQ3 (ORCPT ); Tue, 19 Aug 2008 18:16:29 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752809AbYHSWQT (ORCPT ); Tue, 19 Aug 2008 18:16:19 -0400 Received: from ug-out-1314.google.com ([66.249.92.171]:48856 "EHLO ug-out-1314.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752165AbYHSWQS (ORCPT ); Tue, 19 Aug 2008 18:16:18 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; b=jkHCV4K6sJGV9cXqWpAyB1ejiHITKhUpi0Qd3oA3WdfWqu74zgEr/pa86J3rnDgY/w P2UGiTagENhQs2Y06lo9IOXxXNlOs/hkg4Ndjt+Z05kPQj/YNkoa+Q32lrUdRdFu8r1U x4e0ZjqadKGLyvFS4fsaeo9zOqUhHNpb9UUH0= Subject: [1/2 -tip, BUG-fix] x86-microcode: fix unbalanced use of get_cpu() From: Dmitry Adamushko To: Ingo Molnar Cc: Peter Oruba , Tigran Aivazian , Max Krasnyansky , LKML Content-Type: text/plain Date: Wed, 20 Aug 2008 00:16:13 +0200 Message-Id: <1219184173.10426.33.camel@earth> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2256 Lines: 73 From: Dmitry Adamushko Subject: x86-microcode: fix unbalanced use of get_cpu() Don't use get_cpu() at all. Resort to checking a boot-up CPU (#0) in microcode_{intel,amd}_module_init(). --- Signed-off-by: Dmitry Adamushko commit 9375be36d98cdaecefbd98904609f1aee0d50367 Author: dimm Date: Tue Aug 19 22:40:41 2008 +0200 microcode: bug-fix diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c index 33b2a21..a6e76cc 100644 --- a/arch/x86/kernel/microcode_amd.c +++ b/arch/x86/kernel/microcode_amd.c @@ -500,13 +500,15 @@ static struct microcode_ops microcode_amd_ops = { static int __init microcode_amd_module_init(void) { - struct cpuinfo_x86 *c = &cpu_data(get_cpu()); + struct cpuinfo_x86 *c = &cpu_data(0); equiv_cpu_table = NULL; - if (c->x86_vendor == X86_VENDOR_AMD) - return microcode_init(µcode_amd_ops, THIS_MODULE); - else + if (c->x86_vendor != X86_VENDOR_AMD) { + printk(KERN_ERR "microcode: CPU platform is not AMD-capable\n"); return -ENODEV; + } + + return microcode_init(µcode_amd_ops, THIS_MODULE); } static void __exit microcode_amd_module_exit(void) diff --git a/arch/x86/kernel/microcode_intel.c b/arch/x86/kernel/microcode_intel.c index d2d9d74..6dd8907 100644 --- a/arch/x86/kernel/microcode_intel.c +++ b/arch/x86/kernel/microcode_intel.c @@ -531,12 +531,14 @@ static struct microcode_ops microcode_intel_ops = { static int __init microcode_intel_module_init(void) { - struct cpuinfo_x86 *c = &cpu_data(get_cpu()); + struct cpuinfo_x86 *c = &cpu_data(0); - if (c->x86_vendor == X86_VENDOR_INTEL) - return microcode_init(µcode_intel_ops, THIS_MODULE); - else + if (c->x86_vendor != X86_VENDOR_INTEL) { + printk(KERN_ERR "microcode: CPU platform is not Intel-capable\n"); return -ENODEV; + } + + return microcode_init(µcode_intel_ops, THIS_MODULE); } static void __exit microcode_intel_module_exit(void) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/