From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC7AFC433EF for ; Tue, 9 Nov 2021 01:27:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D5C21610A8 for ; Tue, 9 Nov 2021 01:27:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243605AbhKIBaa (ORCPT ); Mon, 8 Nov 2021 20:30:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:47870 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243805AbhKIBXo (ORCPT ); Mon, 8 Nov 2021 20:23:44 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id CED4261B30; Tue, 9 Nov 2021 01:09:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636420163; bh=4j8T9XMFY0MvMPHgkNFL7ILBeO7yshBWtHpd719O/PU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e1htH4+mVv5hd8sPO+wWWTEuM7RIF8bnfLkG0q3QeQ40nr5pcXhae7TeRtg0rxUgo /GoU8qiaTCEzSzRDog3EIVmmDXVX6zIpwMsROiUYzT8gYfQAKcS7f60Qex/JjIqiv/ M2ZPVUPhEBByZBXtYPaXIUOKgkrvRojeVcdsAA550c8i54eR09Yr21P1vTLFUMj95Q K4AN5oSFvKkJjRrOoURgL50HL8RKyxxFVJPGvw/mQs8Kp5aNJMXlxe9ziLJqxBDs5o HHhfSkfapwQo/CUK/PfPRYaYVnEdM9/5zD+t3DAM+jFp+NqD743duMSZWUux4gvLG4 bx61Gj1XWnijg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= , Hans de Goede , Sasha Levin , markgross@kernel.org, platform-driver-x86@vger.kernel.org Subject: [PATCH AUTOSEL 4.4 03/30] platform/x86: wmi: do not fail if disabling fails Date: Mon, 8 Nov 2021 20:08:51 -0500 Message-Id: <20211109010918.1192063-3-sashal@kernel.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211109010918.1192063-1-sashal@kernel.org> References: <20211109010918.1192063-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Barnabás Pőcze [ Upstream commit 1975718c488a39128f1f515b23ae61a5a214cc3d ] Previously, `__query_block()` would fail if the second WCxx method call failed. However, the WQxx method might have succeeded, 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 Link: https://lore.kernel.org/r/20210904175450.156801-25-pobrn@protonmail.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin --- drivers/platform/x86/wmi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index eb391a2818330..fb16c83900a02 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -367,7 +367,14 @@ struct acpi_buffer *out) * 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; -- 2.33.0