Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1933234ybl; Tue, 3 Dec 2019 15:14:28 -0800 (PST) X-Google-Smtp-Source: APXvYqwTo7UiWbXkI1PU44cNyF++/zWd20Z70ImysPKTGUSdFOtzm5urRFIuQabs1EpE6IhEKyuS X-Received: by 2002:a9d:5f09:: with SMTP id f9mr302516oti.259.1575414867864; Tue, 03 Dec 2019 15:14:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575414867; cv=none; d=google.com; s=arc-20160816; b=xfh5b1ATs+ibpO7VoZCfHudA6zpHFYcix/kipsJcR/67fLVDBgU4H5TNXULpjO3FnF L0/n+hfazx9c2wOGZ9THtqtClNxN649BLwB42bNR+J3C3t0W/isd8s1hIqvMKE+SQv9g 3f7fZIjEfZaPWajtJLoR9lGEOTlnSJQfoX0lDMBWcB4IUornmIf4YLqgRmayy8NHuaah WjXDPMdI0i0LcZRPLaXn08fdbLlX3wKglBwykqQRxUMW24IRStI9YIgZhhXmfBgR+RpN /45IurVMt1A/zKBr35uZl3KA8U+/nsCqoFhHsGaz24G+Zo1Wj6XhTTLjkEXGkAnNoH3j oVSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PVgsvue76WJzUMKdRUaBuw6nH9CbQsJXm0V4s/9BNfc=; b=xkK9kfhuJtEGJUCC3Prmbg0S/yWAQDBZm0pssgNSfbA/DoIHU4A+kwiUlFKSHhkw35 ZapjCWiUB0EH3/mhwT6/QXnJcwxY/JfFddV4kPrBJz2enE4z+LnChQ3wRx9fbif57N8S imqYB/ES6nASIvGHpA2rGGK9h8g/Fl5S4Yny6QLFfjtXrm+qxrTHCE7MYgSd6Ngko3PL K9XvjIh5MtYM4I+Z6C0eSGIrCwJ9sg7NWzOqiFsp+MDCy7cLk8hj3YBSxbn9YxEqpuc8 8HJIhXLZfF5AnX5fNkMA9ZeuQwcgiMrHOIt1VRWb309fPyNa1jVePULlT7AkKd6R+cXg 6qFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=d7n30CM1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v19si2172070otn.313.2019.12.03.15.14.15; Tue, 03 Dec 2019 15:14:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=d7n30CM1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728137AbfLCWjF (ORCPT + 99 others); Tue, 3 Dec 2019 17:39:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:48822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727771AbfLCWjD (ORCPT ); Tue, 3 Dec 2019 17:39:03 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C2202207DD; Tue, 3 Dec 2019 22:39:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575412743; bh=sceLJGCo77DPR9JBaWfFyeAjcJUerBMlT9tLv1Mf0SQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d7n30CM1zWpm9aHCTPE4bbgWPrr/SLQ1QSdQPgBauYqb6UuatCQ/Bf2khwtJOyhOG R5O0UDjoy88iHsVHuIFXiMvLxaYtNufeRwgw43aEILyv78CnCKZzBnmhj1D0OpOpU8 K2Zz49EEtPZ8uxQ3kjufLwlfUfencCnsPjF8VHAM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Andy Shevchenko Subject: [PATCH 5.4 45/46] platform/x86: hp-wmi: Fix ACPI errors caused by too small buffer Date: Tue, 3 Dec 2019 23:36:05 +0100 Message-Id: <20191203212807.107230526@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191203212705.175425505@linuxfoundation.org> References: <20191203212705.175425505@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede commit 16245db1489cd9aa579506f64afeeeb13d825a93 upstream. The HP WMI calls may take up to 128 bytes of data as input, and the AML methods implementing the WMI calls, declare a couple of fields for accessing input in different sizes, specifycally the HWMC method contains: CreateField (Arg1, 0x80, 0x0400, D128) Even though we do not use any of the WMI command-types which need a buffer of this size, the APCI interpreter still tries to create it as it is declared in generoc code at the top of the HWMC method which runs before the code looks at which command-type is requested. This results in many of these errors on many different HP laptop models: [ 14.459261] ACPI Error: Field [D128] at 1152 exceeds Buffer [NULL] size 160 (bits) (20170303/dsopcode-236) [ 14.459268] ACPI Error: Method parse/execution failed [\HWMC] (Node ffff8edcc61507f8), AE_AML_BUFFER_LIMIT (20170303/psparse-543) [ 14.459279] ACPI Error: Method parse/execution failed [\_SB.WMID.WMAA] (Node ffff8edcc61523c0), AE_AML_BUFFER_LIMIT (20170303/psparse-543) This commit increases the size of the data element of the bios_args struct to 128 bytes fixing these errors. Cc: stable@vger.kernel.org BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=197007 BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=201981 BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1520703 Signed-off-by: Hans de Goede Signed-off-by: Andy Shevchenko Signed-off-by: Greg Kroah-Hartman --- drivers/platform/x86/hp-wmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c @@ -65,7 +65,7 @@ struct bios_args { u32 command; u32 commandtype; u32 datasize; - u32 data; + u8 data[128]; }; enum hp_wmi_commandtype { @@ -216,7 +216,7 @@ static int hp_wmi_perform_query(int quer .command = command, .commandtype = query, .datasize = insize, - .data = 0, + .data = { 0 }, }; struct acpi_buffer input = { sizeof(struct bios_args), &args }; struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; @@ -228,7 +228,7 @@ static int hp_wmi_perform_query(int quer if (WARN_ON(insize > sizeof(args.data))) return -EINVAL; - memcpy(&args.data, buffer, insize); + memcpy(&args.data[0], buffer, insize); wmi_evaluate_method(HPWMI_BIOS_GUID, 0, mid, &input, &output);