From patchwork Wed Oct 17 13:49:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Rzeszutek Wilk X-Patchwork-Id: 1606131 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 5BE1D3FD4F for ; Wed, 17 Oct 2012 14:03:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757131Ab2JQODq (ORCPT ); Wed, 17 Oct 2012 10:03:46 -0400 Received: from rcsinet15.oracle.com ([148.87.113.117]:18132 "EHLO rcsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757102Ab2JQODp (ORCPT ); Wed, 17 Oct 2012 10:03:45 -0400 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q9HE3dHG030665 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 17 Oct 2012 14:03:40 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q9HE3aYv018500 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 17 Oct 2012 14:03:37 GMT Received: from abhmt105.oracle.com (abhmt105.oracle.com [141.146.116.57]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q9HE3aGt011402; Wed, 17 Oct 2012 09:03:36 -0500 Received: from phenom.dumpdata.com (/50.195.21.189) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 17 Oct 2012 07:03:36 -0700 Received: by phenom.dumpdata.com (Postfix, from userid 1000) id 17D6E4035E; Wed, 17 Oct 2012 09:49:53 -0400 (EDT) From: Konrad Rzeszutek Wilk To: linux-kernel@vger.kernel.org, xen-devel@lists.xensource.com, lenb@kernel.org, linux-acpi@vger.kernel.org, hpa@zytor.com, x86@kernel.org Cc: Konrad Rzeszutek Wilk Subject: [PATCH 1/4] x86/wakeup/sleep: Check whether the TSS GDT descriptor is empty before using it. Date: Wed, 17 Oct 2012 09:49:43 -0400 Message-Id: <1350481786-4969-2-git-send-email-konrad.wilk@oracle.com> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1350481786-4969-1-git-send-email-konrad.wilk@oracle.com> References: <1350481786-4969-1-git-send-email-konrad.wilk@oracle.com> X-Source-IP: ucsinet21.oracle.com [156.151.31.93] Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org We check the TSS descriptor before we try to dereference it. Also fix up the value to use the #defines. Signed-off-by: Konrad Rzeszutek Wilk --- arch/x86/power/cpu.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c index 218cdb1..c17370e 100644 --- a/arch/x86/power/cpu.c +++ b/arch/x86/power/cpu.c @@ -133,7 +133,9 @@ static void fix_processor_context(void) { int cpu = smp_processor_id(); struct tss_struct *t = &per_cpu(init_tss, cpu); - +#ifdef CONFIG_X86_64 + struct desc_struct *desc = get_cpu_gdt_table(cpu); +#endif set_tss_desc(cpu, t); /* * This just modifies memory; should not be * necessary. But... This is necessary, because @@ -142,7 +144,8 @@ static void fix_processor_context(void) */ #ifdef CONFIG_X86_64 - get_cpu_gdt_table(cpu)[GDT_ENTRY_TSS].type = 9; + if (!desc_empty(&desc[GDT_ENTRY_TSS])) + desc[GDT_ENTRY_TSS].type = DESC_TSS; syscall_init(); /* This sets MSR_*STAR and related */ #endif