Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp806307ybl; Wed, 4 Dec 2019 11:11:44 -0800 (PST) X-Google-Smtp-Source: APXvYqyqqhvyMYAuERmu5qoUeAGMOsfWfM4203EiaU+NqKV0u0jYJ+UI/hj9jGsuFVCil+tp5lsh X-Received: by 2002:aca:5303:: with SMTP id h3mr3844791oib.109.1575486704424; Wed, 04 Dec 2019 11:11:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575486704; cv=none; d=google.com; s=arc-20160816; b=hxfl9KTW+npnL4Z/3/+x6I7eIXjHLULEKKAWzZ6VCuBCNa6xXKZ/67QjnpaQSWu506 h7VRxf2rD6Jdnht/52i+IK5wnoGyRm9HA/obITmdEp3qO25JdQVaODziyjmISfRvWQQY jAzzlPZaB+i60IY2YMDQtpmtTj2InruM3FuLdWr9OxSshPiFs6rTddFXxiqZJg8rYrZz 3Tb3PXdy6lQeJmgFeCvD1mVUBkRkTXp8bcieUpf7hlHeMkBYFQDmknffQjGI+k9lBTyT x170Bf1UQWaIYaQPe0APrgwfhBmJPsTYMCl06bqCXB4JyZDcQzv/7B8oVjqPlqRzuvB8 hbOA== 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=RVClGdQrzJ0aRpO3oAkj9daHx+e2CoF8uAzGOhHGiIM=; b=XvZzncmEy3Mp2L86S/5hoG30Nyj1pGZ7xUT31Tx7+qCFT6F5OeYlEkBQV30XuO12AY XqKDVIj1c5tSR0PAGHdo0VYUGXn1uns0aAOyhuWBN9o6XySaNvtFFzfEoiY8yxz6XpsC 026mPmec+4zs2mjUBQ9wfDKyecY+dazE9mkV9dmXJx2+DsyK7p094q8GOKQ72NwRn55G sVgikyKx2wbLtK42J7FijswqVobfSnWS/H02kz9X2rYUSabrWKiA7h+3Pp8xWkwEj1vO BboI9hJaVVib9TFlkFVv5lgl0ssCrcFqWlzPYlPOYMbzDmrK5qXrR5BsUCrJh4t4pNKb jHQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tAODdpRm; 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 k130si3819954oih.135.2019.12.04.11.11.32; Wed, 04 Dec 2019 11:11:44 -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=tAODdpRm; 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 S1731093AbfLDSJf (ORCPT + 99 others); Wed, 4 Dec 2019 13:09:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:35332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731069AbfLDSJb (ORCPT ); Wed, 4 Dec 2019 13:09:31 -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 E2D7420833; Wed, 4 Dec 2019 18:09:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482970; bh=HLzYD/HbGyf9vZgF+em7Xrr/GbFuua27gc0B8hIZUeg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tAODdpRmvUj+C0q4Hgi6OdJbcSey+4Jp2Bzy9QToiyc6qduo3HKGnY4INg9B7Vyk/ oKtZOAH7UGImJBxY/le5WoSNW4ts4ieu1r3I6FVG0vxOofhade5K/qSLIRJ6ZWs3Be 00EQU4NyddFWeOhe14DmaIcV2KV2wZ4cQdPh0wgo= 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.14 208/209] platform/x86: hp-wmi: Fix ACPI errors caused by passing 0 as input size Date: Wed, 4 Dec 2019 18:57:00 +0100 Message-Id: <20191204175337.805782234@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204175321.609072813@linuxfoundation.org> References: <20191204175321.609072813@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 f3e4f3fc8ee9729c4b1b27a478c68b713df53c0c upstream. The AML code implementing the WMI methods creates a variable length field to hold the input data we pass like this: CreateDWordField (Arg1, 0x0C, DSZI) Local5 = DSZI /* \HWMC.DSZI */ CreateField (Arg1, 0x80, (Local5 * 0x08), DAIN) If we pass 0 as bios_args.datasize argument then (Local5 * 0x08) is 0 which results in these errors: [ 71.973305] ACPI BIOS Error (bug): Attempt to CreateField of length zero (20190816/dsopcode-133) [ 71.973332] ACPI Error: Aborting method \HWMC due to previous error (AE_AML_OPERAND_VALUE) (20190816/psparse-529) [ 71.973413] ACPI Error: Aborting method \_SB.WMID.WMAA due to previous error (AE_AML_OPERAND_VALUE) (20190816/psparse-529) And in our HPWMI_WIRELESS2_QUERY calls always failing. for read commands like HPWMI_WIRELESS2_QUERY the DSZI value is not used / checked, except for read commands where extra input is needed to specify exactly what to read. So for HPWMI_WIRELESS2_QUERY we can safely pass the size of the expected output as insize to hp_wmi_perform_query(), as we are already doing for all other HPWMI_READ commands we send. Doing so fixes 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c @@ -393,7 +393,7 @@ static int hp_wmi_rfkill2_refresh(void) int err, i; err = hp_wmi_perform_query(HPWMI_WIRELESS2_QUERY, HPWMI_READ, &state, - 0, sizeof(state)); + sizeof(state), sizeof(state)); if (err) return err; @@ -790,7 +790,7 @@ static int __init hp_wmi_rfkill2_setup(s int err, i; err = hp_wmi_perform_query(HPWMI_WIRELESS2_QUERY, HPWMI_READ, &state, - 0, sizeof(state)); + sizeof(state), sizeof(state)); if (err) return err < 0 ? err : -EINVAL;