From patchwork Tue Aug 17 00:54:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jin Dongming X-Patchwork-Id: 119829 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o7H0sO8M003177 for ; Tue, 17 Aug 2010 00:54:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754071Ab0HQAx5 (ORCPT ); Mon, 16 Aug 2010 20:53:57 -0400 Received: from fgwmail6.fujitsu.co.jp ([192.51.44.36]:57266 "EHLO fgwmail6.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754068Ab0HQAxx (ORCPT ); Mon, 16 Aug 2010 20:53:53 -0400 Received: from m2.gw.fujitsu.co.jp ([10.0.50.72]) by fgwmail6.fujitsu.co.jp (Fujitsu Gateway) with ESMTP id o7H0ro9U029941 (envelope-from jin.dongming@np.css.fujitsu.com); Tue, 17 Aug 2010 09:53:50 +0900 Received: from smail (m2 [127.0.0.1]) by outgoing.m2.gw.fujitsu.co.jp (Postfix) with ESMTP id 2EA2645DD77; Tue, 17 Aug 2010 09:53:50 +0900 (JST) Received: from s2.gw.fujitsu.co.jp (s2.gw.fujitsu.co.jp [10.0.50.92]) by m2.gw.fujitsu.co.jp (Postfix) with ESMTP id 0775D45DE51; Tue, 17 Aug 2010 09:53:50 +0900 (JST) Received: from s2.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s2.gw.fujitsu.co.jp (Postfix) with ESMTP id E70891DB8038; Tue, 17 Aug 2010 09:53:49 +0900 (JST) Received: from m003.s.css.fujitsu.com (m003.s.css.fujitsu.com [10.23.4.33]) by s2.gw.fujitsu.co.jp (Postfix) with ESMTP id 6E5B1E08002; Tue, 17 Aug 2010 09:53:46 +0900 (JST) Received: from m003.css.fujitsu.com (m003 [127.0.0.1]) by m003.s.css.fujitsu.com (Postfix) with ESMTP id D1E1D2E011B; Tue, 17 Aug 2010 09:53:45 +0900 (JST) Received: from [127.0.0.1] (unknown [10.124.102.46]) by m003.s.css.fujitsu.com (Postfix) with ESMTP id 83C312DFB22; Tue, 17 Aug 2010 09:53:45 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v1.5.1 Message-ID: <4C69DDB5.6060103@np.css.fujitsu.com> Date: Tue, 17 Aug 2010 09:54:13 +0900 From: Jin Dongming User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; ja; rv:1.9.2.7) Gecko/20100713 Thunderbird/3.1.1 MIME-Version: 1.0 To: Huang Ying CC: Randy Dunlap , Stephen Rothwell , Andi Kleen , Hidetoshi Seto , ACPI , LKLM Subject: [PATCH 1/4] [Patch-next] ACPI, APEI, ERST Fix the wrong checking of Serialization Header's length Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 17 Aug 2010 00:54:24 +0000 (UTC) diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 864dd46..28a5caf 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c @@ -358,7 +358,8 @@ static struct apei_exec_ins_type erst_ins_type[] = { static inline void erst_exec_ctx_init(struct apei_exec_context *ctx) { apei_exec_ctx_init(ctx, erst_ins_type, ARRAY_SIZE(erst_ins_type), - ERST_TAB_ENTRY(erst_tab), erst_tab->entries); + ERST_TAB_ENTRY(erst_tab), + erst_tab->seri_header.entries); } static int erst_get_erange(struct erst_erange *range) @@ -749,12 +750,14 @@ __setup("erst_disable", setup_erst_disable); static int erst_check_table(struct acpi_table_erst *erst_tab) { - if (erst_tab->header_length != sizeof(struct acpi_table_erst)) + if (erst_tab->common_header.length < sizeof(struct acpi_table_erst)) return -EINVAL; - if (erst_tab->header.length < sizeof(struct acpi_table_erst)) + + if (erst_tab->seri_header.length != sizeof(struct acpi_erst_header)) return -EINVAL; - if (erst_tab->entries != - (erst_tab->header.length - sizeof(struct acpi_table_erst)) / + + if (erst_tab->seri_header.entries != + (erst_tab->common_header.length - sizeof(struct acpi_table_erst)) / sizeof(struct acpi_erst_entry)) return -EINVAL; diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index c637b75..821f8ac 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h @@ -283,13 +283,21 @@ enum acpi_einj_command_status { * ******************************************************************************/ -struct acpi_table_erst { - struct acpi_table_header header; /* Common ACPI table header */ - u32 header_length; +/* ERST Serialization Header */ + +struct acpi_erst_header { + u32 length; u32 reserved; u32 entries; }; +/* ERST Header */ + +struct acpi_table_erst { + struct acpi_table_header common_header; /* Common ACPI table header */ + struct acpi_erst_header seri_header; /* ERST Serialization Header */ +}; + /* ERST Serialization Entries (actions) */ struct acpi_erst_entry {