Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp736954ybl; Wed, 4 Dec 2019 10:02:40 -0800 (PST) X-Google-Smtp-Source: APXvYqzccaN/prDM/1YPrSZIw3W4aBlXr7KP1YqMjDq18+LjpdHsggWrX+RJclE6Q/pe+sf4kawK X-Received: by 2002:aca:d502:: with SMTP id m2mr3535206oig.41.1575482560044; Wed, 04 Dec 2019 10:02:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575482560; cv=none; d=google.com; s=arc-20160816; b=Bp/ZA/mozTT20WymC6cy/wjdAjlhA5/2SvtpJJ73aVLvChS9Z5KjozV9qZFAngrNhA HbCYA7J9XPc9VG3lP8w+no77xLGQJql16OhzgZKetKoMFAWO0UjKCQCjQUJlwrEV7VjB wblxFTY/W4EwDB+mOhZPrKrp8FmOjWOldQRbfjXBclwr+cknM7CMe+sD/oTsIZ85ZXcE AmZmPqV4Gus62ALuwjoZ/aMI18GHVgmaXO6JM2yb+9OFjVP98VYhkR7czLYlN0WYZg/k 9flD+/+SRVFbu6vYkCKFh3sWnCyhC0rmQkcuvuh5KHlbGSSzbuEgoPkX+raVKPUaBDRv 7pBg== 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=XPhvQ4ibDjZEXux3F+JzMsHCjsjIogJHJtsNR9R+hms=; b=D14YAIdL+OFQDZ2XuCfEy4D3tyrqZH7rSzqESCUA7J6J5qTUnbl/jaLe56PirjeAm8 K8CY6KqRJLaR3BmNVGmkfy8yNrgaG+gjZLiCxgBWQo/7xrStyNMwCc7Mxo4fGqwmM+dK 8VTvcT9Y4U2LeVKtfX3OKG/Ak+U5qHGD8VpEb/N3EfmZ5+Rhsc3zIDFaM24N+Jzasx0p kagLAQ+utlBdbnUE2XRYom2Shn1Ta2jVALX03OMJx1ooyskzBbmtdrzhrD8ganY7cu8u GgvPMrQOkAnWjyN07uSG7OHuVM0LWISM0kCjNVi42O40NJ3qtTtj/AZiPAHSuixin8wC PWnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YSeuxmUy; 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 m85si3614433oig.158.2019.12.04.10.02.25; Wed, 04 Dec 2019 10:02:40 -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=YSeuxmUy; 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 S1729504AbfLDSBH (ORCPT + 99 others); Wed, 4 Dec 2019 13:01:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:40870 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729494AbfLDSBF (ORCPT ); Wed, 4 Dec 2019 13:01:05 -0500 Received: from localhost (unknown [217.68.49.72]) (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 7211820675; Wed, 4 Dec 2019 18:01:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482464; bh=bcA6ctyJlHC5RPREiPx2jX8ShjRw7n83MkRwmjmHGSs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YSeuxmUy604Yg1b/ClhSfVgzxlRC9XSBiRcmG47ppAoiPraunQGUTXVLdiRng7FmQ JPGhl6igm8iH4g8KOYNvYvdNhMQvnTAyhC30shiIMRfaQnhQ+PkZZJZuwt6q9cwlzT QcbE6Edl9xPtqS3Ff18MQzeEjCtGPAGu74Z4QSWs= 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 4.4 92/92] platform/x86: hp-wmi: Fix ACPI errors caused by too small buffer Date: Wed, 4 Dec 2019 18:50:32 +0100 Message-Id: <20191204174335.665089903@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204174327.215426506@linuxfoundation.org> References: <20191204174327.215426506@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 @@ -90,7 +90,7 @@ struct bios_args { u32 command; u32 commandtype; u32 datasize; - u32 data; + u8 data[128]; }; struct bios_return { @@ -199,7 +199,7 @@ static int hp_wmi_perform_query(int quer .command = write ? 0x2 : 0x1, .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 }; @@ -207,7 +207,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, 0x3, &input, &output);