From patchwork Sat Mar 14 00:06:27 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 11867 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2E0KwrM030104 for ; Sat, 14 Mar 2009 00:20:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753921AbZCNATl (ORCPT ); Fri, 13 Mar 2009 20:19:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753894AbZCNATl (ORCPT ); Fri, 13 Mar 2009 20:19:41 -0400 Received: from kroah.org ([198.145.64.141]:34991 "EHLO coco.kroah.org" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753642AbZCNATk (ORCPT ); Fri, 13 Mar 2009 20:19:40 -0400 Received: from localhost (c-76-105-230-205.hsd1.or.comcast.net [76.105.230.205]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by coco.kroah.org (Postfix) with ESMTPSA id 8B545490D7; Fri, 13 Mar 2009 17:19:38 -0700 (PDT) X-Mailbox-Line: From gregkh@mini.kroah.org Fri Mar 13 17:07:51 2009 Message-Id: <20090314000751.065212331@mini.kroah.org> User-Agent: quilt/0.48-1 Date: Fri, 13 Mar 2009 17:06:27 -0700 From: Greg KH To: linux-kernel@vger.kernel.org, stable@kernel.org, Len Brown Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , Chris Wedgwood , Michael Krufky , Chuck Ebbert , Domenico Andreoli , Willy Tarreau , Rodrigo Rubira Branco , Jake Edge , Eugene Teo , torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, linux-acpi@vger.kernel.org, Lin Ming , Henrique de Moraes Holschuh Subject: [patch 79/96] ACPI: fix broken usage of name.ascii References: <20090314000508.803142980@mini.kroah.org> Content-Disposition: inline; filename=acpi-fix-broken-usage-of-name.ascii.patch In-Reply-To: <20090314001449.GA4485@kroah.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 2.6.27-stable review patch. If anyone has any objections, please let us know. ------------------ From: Henrique de Moraes Holschuh This issue was fixed indirectly in mainline by commit 0175d562a29ad052c510782c7e76bc63d5155b9b. acpi_namespace_node's name.ascii field is four chars, and not NULL- terminated except by pure luck. So, it cannot be used by sscanf() without a length restriction. This is the minimal fix for both stable 2.6.27 and 2.6.28. Signed-off-by: Henrique de Moraes Holschuh Cc: Lin Ming Cc: Len Brown Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/ec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -759,9 +759,10 @@ acpi_ec_register_query_methods(acpi_hand struct acpi_namespace_node *node = handle; struct acpi_ec *ec = context; int value = 0; - if (sscanf(node->name.ascii, "_Q%x", &value) == 1) { + + if (sscanf(node->name.ascii, "_Q%2x", &value) == 1) acpi_ec_add_query_handler(ec, value, handle, NULL, NULL); - } + return AE_OK; }