Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1459F38F950; Sat, 17 Oct 2026 18:04:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792260255; cv=none; b=A1ZzAHMrOh7DWDhBaH6LPf8hi3Y3IrLY9xY7BX3i325mdMFpAK63Z+GfieOGHBe/DEELwQ6QXiH935cQpiQxh5EiE/LCP3W9Nf/c/Sai39zBiW/x52zt/WQ9Egpoen7yqAAXSFsYTNx+r91ZkaGg/6gORjGhLLIQqKHn8rbLbWw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792260255; c=relaxed/simple; bh=9xhoGIrPcEPyO/ZTxGS1tqF7G10gtEM7cmy/pluZ5gg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iqTvhraqVMVYdc2NYhmK04Z5znodG38B+GDpxmXyYWG2CdltKLWqOhivEYL/0uMcETbv/mE4vul7CiQGhLp0ZUHxf4HN3apoFY/lDBuv8++YFRCKnMLaqDhmmZVljEfhHRKjhYJN7c07MFO8aHdkbM5lEPq1/SchK/ZvrfWeBx0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=GxervQg+; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="GxervQg+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 533311F000C4; Sat, 17 Oct 2026 18:04:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792260253; bh=6RnyW2YDkrEWsCBn6zhtk6y/bRXyFHAof53fE9hswEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GxervQg+lvn2FKKhtDRa/38E4HnSqR7SnZTzfFwzvW2N4DI2d9BkSDmYx83saJ3VP Sg7SSbnmgGblkG/LC9V0YEuF5qzvDS0ynNTotd+Lu5LBWa6KKPZfG82MGw507riWfV mryIG5Vbt+nb76qVXGSzj/1WTBSnNiaZmQMDkKpo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Marco Scardovi , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Sasha Levin Subject: [PATCH 6.6 1483/1674] platform/x86: asus-wmi: fix resource leaks on probe failure Date: Sat, 17 Oct 2026 18:02:35 +0200 Message-ID: <20261017160509.213368993@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160431.119607952@linuxfoundation.org> References: <20261017160431.119607952@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marco Scardovi [ Upstream commit ef3daa2b84a2b8499ce9e2ce1c865dca36d39f95 ] During driver initialization in asus_wmi_add(), various subsystems are registered sequentially. However, the error path labels are out of order relative to the registration sequence. Specifically: 1. If asus_wmi_custom_fan_curve_init() fails, the driver jumps to fail_custom_fan_curve. Because this label is placed below fail_sysfs, it bypasses the cleanup calls for the input device and sysfs groups, which were successfully registered before, leaking those resources. 2. If asus_screenpad_init() fails, the driver jumps to fail_screenpad. Because fail_screenpad is placed below fail_backlight, it bypasses the cleanup calls for backlight and rfkill, leaking those resources. Fix these resource leaks by reordering the error path labels in asus_wmi_add() to match the exact reverse order of the resource allocations. Fixes: 0f0ac158d28f ("platform/x86: asus-wmi: Add support for custom fan curves") Fixes: 2c97d3e55b70 ("platform/x86: asus-wmi: add support for ASUS screenpad") Assisted-by: Antigravity:gemini-3.5-flash Signed-off-by: Marco Scardovi Link: https://patch.msgid.link/20260617155104.10111-1-scardracs@disroot.org Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen Signed-off-by: Sasha Levin --- drivers/platform/x86/asus-wmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index a7af32723a089..a76d43ca647d4 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -4470,12 +4470,12 @@ static int asus_wmi_add(struct platform_device *pdev) fail_rfkill: asus_wmi_led_exit(asus); fail_leds: +fail_custom_fan_curve: fail_hwmon: asus_wmi_input_exit(asus); fail_input: asus_wmi_sysfs_exit(asus->platform_device); fail_sysfs: -fail_custom_fan_curve: fail_platform_profile_setup: if (asus->platform_profile_support) platform_profile_remove(); -- 2.53.0