From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.45 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796167912; b=fDJNpf3WCj8Tx+WapJi6j/AXvC4seM7bBb7QyZNT5idUr8gHzHhgpu9VTd03Pe2h2tAK J6cNRh/s1aY01qIsBnpmVXPq9lsVWoKccz17FVsUUAqLbXttwyYeagCqafgg+h9yhZWBE IDEmJF1sz8STB8amCUMChnGIEotIy0IKJZhYXAcbGOA4tfppMHa5Mp2lSMPT0aVj0BHyN gqbEQKBvSxPvqGKJDdFKWYdj4CBJT3IiJGrl1HTAzbqxT6eVhfxfK/8uLw5sI/BMb8knE Ptp7OaAxjzSvL+S+6PQmphnAXS7GqGI+/+aaKr938cbkmHj6dksaDozhAJ6wANa3TAQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796167912; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Subject:Date:Message-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:X-B4-Tracking:X-Change-ID:To:Cc:X-Mailer; bh=0UNocoDATYpBH01i05aPSIACY5FSekPrxbbnptHEjn4=; b=j3yebnLPxXKuK7TBquTYpQuhp4NNG0e8qN+K6junms46EUqO3F0CDvTCYmXPAgQ9hnuB YBPIwIGd+OviO3+48ysRcCFVtT4E6AaKilpz8JI7EfWVnZvGcPhM69yASjM272kTrxqWT 7lGTA83quFrwbUAxcM0lzb+dIhpM3PUki84OiGHmHvewoYFuSGTcge9NlMTyZjtDcGz6w lvLvVC6/jq0x5aYhhPLf7gLV8sfu+aqNPZwdBXnegurJ6EfHCv6al60Lb2LfJknch3aq9 ZQJfu1NAJkN6nlQp+Qld1QjUgYL5LYuamdQqAFOcX5YGgcfv9lXUAD3InoEnBBosPjA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=BpyKfSKB; arc=none smtp.remote-ip=209.85.221.45 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DCC6606A322 for ; Tue, 1 Dec 2026 23:31:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3DCC6606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=BpyKfSKB Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-4a9be758734so7883388f8f.1 for ; Tue, 01 Dec 2026 15:31:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796167911; x=1796772711; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:content-type:mime-version :message-id:date:subject:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=0UNocoDATYpBH01i05aPSIACY5FSekPrxbbnptHEjn4=; b=BpyKfSKBuDGIn4HGyll1tnyH7R9uSrPAU6xn8cNO829VlMPV7/wfL2b3o9kV1LsQvi 850nC9DyExbWHdvdBOXakF4i5RKSMpCI/w+iuWMFtywwwbiuWWWpDd8oPOXx5p586quh 3quBr4Bh6I3EZirXNVay97YDR7uqTLcliisyr5Xi+c4wE5VVz3Av9ii4LDrLg8LEkIBx eaJQl5AsYY6b1h0h5AzPyTuxHcGBNPwcNa0PtZG4koXgDUCRohbw26BR51548X+lKa4K /VmTdCBUdWw49wKqR6e+uQ1LDasWkRbepHS7RdTg+4ruv1yxVw4ad6yQlptebJv+ij9C +d/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796167911; x=1796772711; h=cc:to:content-transfer-encoding:content-type:mime-version :message-id:date:subject:from:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=0UNocoDATYpBH01i05aPSIACY5FSekPrxbbnptHEjn4=; b=AyW2ewzwONSplE27C6XBMgVPb3jnAACu3b6/o+3io5RB26hqNY4erinxfau/pmupgO S1qjm0+v3OkayLVCXhPEEV0C19lpLh+mOgfklPkW9+r30r6vbASA7vhYCc7Yi12RrtiN jXZcUv2OhOCaTRfW0GOfdjamRrmrdhtkfJ8tYSE2rkPu7Z4ggOJx0rPF8jYe9k3mysif eJBznrKvhYyh/W3wGvz/nrTQgIPtTr/haIfpHm34uwxnBznrv5V056fd/+Oq7DrZ3YrC hsh3bPJCaHltUr5Lob9rPwbnwOT+8WdYNV45sNk/jx6KQyz8ZHz12dJEpgaw3E/0dJOM UuFg== X-Forwarded-Encrypted: i=1; AL+hErEke/8bhrrP8IjJZnEDiWK8VWi31k5qZ9hqGFf9oRKVVeAvMH+QfvqgVICnjAh3wjUFcUBxyq8RBAVp/I4=@vger.kernel.org X-Gm-Message-State: APuU4Z/DPNL6u6BYnoI/zREq7uB1ciskBBnnXf64TS3TTep3eTilSAVX 2TbRGa8wDpUJG4WbtWQ8orZIoUUFVqXs3pEvp8Kj4eRvNJjKbLv9/nGN X-Gm-Gg: AZFdTZcVHhaBk1tbf1GChIDRbqQR/VycDij6sJngMjRCjfcVMdEtR3sXN/lns0XlXjp IaP+Obw9ldK+rfYJ8WS4LP9b8ZlHKD407JXhqals1JzJzdVOVF6FifMUP/Lj2bJ6r71NA0OmyOT vc63wIgAeQZegwD2BBEu3s+W0+3phxMALnRo3uEslCs2bmXQo3YOt+2OVgq/pLbxCTmqJrVLPqN XgbpDa4AbahZbPzCHTKGLE6ikftRy9w6+jDcguodXVdVEWN5XkxHED6JqN0+DA2vDEcWUF1uCdf z45r5sucDBLVZMnWQHyiByi4gXIJaWomL7B38VUp9SxsBIg7k0PiEMb3Xt1TbSWRSqeV+0Rt1df VgQDMHDRPgKnjKvp1MrTWgemqLk9ecOrR51u1sLhxFu31V+CEex4a2zwGfBL42dFvfWc9Cbs1e5 uqHctqEl7En2wcreAV+vr/o3UBlrnEmv6fi2b04X+UwpQAcUDwgkKS5kVBYRN2TlTClmPKgYqAO T/xuORJvQ82hXdTYm43RYIMzDOxDJNyXya4BKF5qgXphJHCYpGd5eYkUnCXOs3qoeaR7C+SxAPM bwQ1ggomqBDzGSbdOy9s/tSrUno= X-Received: by 2002:a05:6000:4283:b0:492:ea10:b073 with SMTP id ffacd0b85a97d-4abaf74016emr76984213f8f.18.1796167910556; Tue, 01 Dec 2026 15:31:50 -0800 (PST) Received: from [127.0.1.1] ([85.105.252.11]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6a680483sm73983323f8f.28.2026.12.01.15.31.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 15:31:49 -0800 (PST) From: Bartu Alev Subject: [PATCH 0/3] platform/asus: asus-wmi: harden asus_wmi_evaluate_method_buf() Date: Wed, 02 Dec 2026 02:31:41 +0300 Message-Id: <20261202-asus-wmi-eval-buf-v1-0-640c12d437dc@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIzNDIKGbWFxarFuem6mbWpaYo5tUmqabYmmemmRpaJRslmKkBNRXUJSallk BNjM6FsIvLk3KSk0uARmkVFsLAJHQMrV1AAAA X-Change-ID: 20261202-asus-wmi-eval-buf-d97eb912c6d2 To: Corentin Chary , "Luke D. Jones" , Denis Benato , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Bartu Alev , stable@vger.kernel.org X-Mailer: b4 0.15.2 During review of the TUF keyboard RGB readback series [1] (and earlier noted in the fan floor series [2]), two defects and follow-up cleanup opportunities were identified in asus_wmi_evaluate_method_buf(): 1. It dereferences output.pointer in switch (obj->type) without checking for NULL, even though acpi_evaluate_object() returns AE_OK with output.pointer == NULL when a method returns no object. 2. In the ACPI_TYPE_INTEGER case, it assigns the u32 firmware value directly to signed int err. Values with bit 31 set alias negative errnos (e.g., 0xffffffff becomes -EPERM), while positive integers (such as ASUS_WMI_DSTS_UNKNOWN_BIT, 0x2, seen on ASUS hardware) can propagate to sysfs/kernfs via fan_curve_enable_store() as a positive byte count instead of an error. This series separates those fixes from the TUF RGB readback feature and splits the changes into three logical patches: 1. Fix the NULL dereference and integer decoding in plain C, using manual kfree() and top-of-block declarations without touching the asus_wmi_evaluate_method_locked() call site. Keeping this patch free of cleanup.h (__free) dependencies allows it to apply cleanly to active -stable trees down to 6.1 LTS. 2. Convert the helper to __free(kfree) and take ownership of output.pointer immediately after asus_wmi_evaluate_method_locked(). This removes the out_free goto and also frees return_buffer->pointer if ACPICA fails in acpi_ut_copy_iobject_to_eobject() after acpi_ut_initialize_buffer() has already allocated it. 3. Add kernel-doc for asus_wmi_evaluate_method_buf(), documenting its parameters, partial-copy behavior when replies are shorter than @size, and all error returns as a ReST list. [1] https://lore.kernel.org/all/20261029-asus-tuf-rgb-v4-v4-0-0d3b877d2c30@gmail.com/ [2] https://lore.kernel.org/all/20261101-asus-fan-floors-v4-v1-0-b8d1c31a99a9@gmail.com/ Signed-off-by: Bartu Alev --- Bartu Alev (3): platform/asus: asus-wmi: Fix NULL deref and integer handling in asus_wmi_evaluate_method_buf() platform/asus: asus-wmi: Use __free(kfree) in asus_wmi_evaluate_method_buf() platform/asus: asus-wmi: Document asus_wmi_evaluate_method_buf() drivers/platform/asus/asus-wmi.c | 63 +++++++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 14 deletions(-) --- base-commit: f09fec5a32d43dd3f9e32d531d05422a9f6191d0 change-id: 20261202-asus-wmi-eval-buf-d97eb912c6d2 Best regards, -- Bartu Alev