From patchwork Sat Sep 4 17:56:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 12475753 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A356C433EF for ; Sat, 4 Sep 2021 17:56:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4B7C560F51 for ; Sat, 4 Sep 2021 17:56:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237320AbhIDR5i (ORCPT ); Sat, 4 Sep 2021 13:57:38 -0400 Received: from mail-4322.protonmail.ch ([185.70.43.22]:36185 "EHLO mail-4322.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237178AbhIDR5i (ORCPT ); Sat, 4 Sep 2021 13:57:38 -0400 Date: Sat, 04 Sep 2021 17:56:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1630778195; bh=bYrWE5J1d/UXgeba5aFcYrMsGmVzAnYYqLg6oDZgVic=; h=Date:To:From:Reply-To:Subject:From; b=Z34r2xLvR7ALt1Wpcgrqud3Eglg93Fl6AKWt6ci6Dihzm3tk4pKW468I6t2NYn9hE sjxlDT5+eGdg/vVd6E8nDKfAXtTa6ppKEgHD5QooPVvbjQjwVh8aW9k9rOjJy9oGRU gEAbKKE8pVoWkOJDCpide4XWG3ZTb5sJfz3fNaY8= To: Hans de Goede , Mark Gross , platform-driver-x86@vger.kernel.org From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Reply-To: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Subject: [RFC PATCH v1 24/30] platform/x86: wmi: do not fail if disabling fails Message-ID: <20210904175450.156801-25-pobrn@protonmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Previously, `__query_block()` would fail if the second WCxx method call failed. However, the WQxx method might have succeded, and potentially allocated memory for the result. Instead of throwing away the result and potentially leaking memory, ignore the result of the second WCxx call. Signed-off-by: Barnabás Pőcze --- drivers/platform/x86/wmi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -- 2.33.0 diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index ec5ba2970840..5929d9d26801 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -352,7 +352,14 @@ static acpi_status __query_block(struct wmi_block *wblock, u8 instance, * the WQxx method failed - we should disable collection anyway. */ if ((block->flags & ACPI_WMI_EXPENSIVE) && ACPI_SUCCESS(wc_status)) { - status = acpi_execute_simple_method(handle, wc_method, 0); + /* + * Ignore whether this WCxx call succeeds or not since + * the previously executed WQxx method call might have + * succeeded, and returning the failing status code + * of this call would throw away the result of the WQxx + * call, potentially leaking memory. + */ + acpi_execute_simple_method(handle, wc_method, 0); } return status;