Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 633162FE067 for ; Tue, 19 Aug 2025 17:19:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755623991; cv=none; b=uHLtib2999olRbb78WPcrl+cGeU45YLEULcCvw10+PbgzK4wgkSn6TFGuiSn7ng0ZY+enMaGpZ+nil7AesVEFMF/thbTb/SocylMD4GkfpKMZKQelHP/mrxTYJNclebSGC/yVaXO2Ra8GCiTsrmQ44hSTQ53ABMLiItuRiYZHC8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755623991; c=relaxed/simple; bh=jcdwOsbNDRNFMCAyrMbBltClV2HhJQMK1oZx2/yAQlA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=grWC5GiUefGREGLcZU0DEC7KvGcf5/rNVYwK/NSZXnmHKFfYAO70EJ/gbezdH9ZCz7bNmmOSuZhSVUKSR8zE0ZgTDtPOXG7gSEBQlp1W/Fexes9k7QnBL1ybG5fY09h4wHirl7zcNtPBHTW+qi33+hZWqnG4aBC5A6GRDs6QLYA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=t3XMwd2x; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="t3XMwd2x" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 632C2C4CEF1; Tue, 19 Aug 2025 17:19:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1755623991; bh=jcdwOsbNDRNFMCAyrMbBltClV2HhJQMK1oZx2/yAQlA=; h=From:To:Cc:Subject:Date:Reply-to:From; b=t3XMwd2xOwZdl8b/YaVOPB6BiWcsrdz/K54V7KGvD5roSgY60XEAbZMdrVCp1of1f RySrZXFWPLOk22pFzNjRqA4UGCekSPzJAYhjEDUksFwzQpXsZkg+0l2W+wAUARv9nE 0DcYXxGxGA9J0pHPykgiM0mpLbMcF6euxMHIkJHE= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-38557: HID: apple: validate feature-report field count to prevent NULL pointer dereference Date: Tue, 19 Aug 2025 19:18:04 +0200 Message-ID: <2025081905-CVE-2025-38557-4b79@gregkh> X-Mailer: git-send-email 2.50.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=5052; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=sUH92qQ49b5rVaQ6R0C6jezNkVGuqD2S3ExoVB/oNb4=; b=owGbwMvMwCRo6H6F97bub03G02pJDBlLNp6bG3X3Y6zC/QsW8cyW3zwFmvN3/5cI1r1il61i8 Nz0jE5xRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEzkUjjDbDbrvpuvxLwPTJvg KavbdnzrYZ3qMwwLri2LPjlJ7ECNRcb6k4K/nUzvJjBXAQA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: HID: apple: validate feature-report field count to prevent NULL pointer dereference A malicious HID device with quirk APPLE_MAGIC_BACKLIGHT can trigger a NULL pointer dereference whilst the power feature-report is toggled and sent to the device in apple_magic_backlight_report_set(). The power feature-report is expected to have two data fields, but if the descriptor declares one field then accessing field[1] and dereferencing it in apple_magic_backlight_report_set() becomes invalid since field[1] will be NULL. An example of a minimal descriptor which can cause the crash is something like the following where the report with ID 3 (power report) only references a single 1-byte field. When hid core parses the descriptor it will encounter the final feature tag, allocate a hid_report (all members of field[] will be zeroed out), create field structure and populate it, increasing the maxfield to 1. The subsequent field[1] access and dereference causes the crash. Usage Page (Vendor Defined 0xFF00) Usage (0x0F) Collection (Application) Report ID (1) Usage (0x01) Logical Minimum (0) Logical Maximum (255) Report Size (8) Report Count (1) Feature (Data,Var,Abs) Usage (0x02) Logical Maximum (32767) Report Size (16) Report Count (1) Feature (Data,Var,Abs) Report ID (3) Usage (0x03) Logical Minimum (0) Logical Maximum (1) Report Size (8) Report Count (1) Feature (Data,Var,Abs) End Collection Here we see the KASAN splat when the kernel dereferences the NULL pointer and crashes: [ 15.164723] Oops: general protection fault, probably for non-canonical address 0xdffffc0000000006: 0000 [#1] SMP KASAN NOPTI [ 15.165691] KASAN: null-ptr-deref in range [0x0000000000000030-0x0000000000000037] [ 15.165691] CPU: 0 UID: 0 PID: 10 Comm: kworker/0:1 Not tainted 6.15.0 #31 PREEMPT(voluntary) [ 15.165691] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 [ 15.165691] RIP: 0010:apple_magic_backlight_report_set+0xbf/0x210 [ 15.165691] Call Trace: [ 15.165691] [ 15.165691] apple_probe+0x571/0xa20 [ 15.165691] hid_device_probe+0x2e2/0x6f0 [ 15.165691] really_probe+0x1ca/0x5c0 [ 15.165691] __driver_probe_device+0x24f/0x310 [ 15.165691] driver_probe_device+0x4a/0xd0 [ 15.165691] __device_attach_driver+0x169/0x220 [ 15.165691] bus_for_each_drv+0x118/0x1b0 [ 15.165691] __device_attach+0x1d5/0x380 [ 15.165691] device_initial_probe+0x12/0x20 [ 15.165691] bus_probe_device+0x13d/0x180 [ 15.165691] device_add+0xd87/0x1510 [...] To fix this issue we should validate the number of fields that the backlight and power reports have and if they do not have the required number of fields then bail. The Linux kernel CVE team has assigned CVE-2025-38557 to this issue. Affected and fixed versions =========================== Issue introduced in 6.11 with commit 394ba612f9419ec5bfebbffb72212fd3b2094986 and fixed in 6.12.42 with commit ba08cc6801ec5fb98f2d02b5f0c614c931845325 Issue introduced in 6.11 with commit 394ba612f9419ec5bfebbffb72212fd3b2094986 and fixed in 6.15.10 with commit 7e15d1eaa88179c5185e57a38ab05fe852d0cb8d Issue introduced in 6.11 with commit 394ba612f9419ec5bfebbffb72212fd3b2094986 and fixed in 6.16.1 with commit 00896c3f41cb6b74fec853386076115ba50baf0a Issue introduced in 6.11 with commit 394ba612f9419ec5bfebbffb72212fd3b2094986 and fixed in 6.17-rc1 with commit 1bb3363da862e0464ec050eea2fb5472a36ad86b Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2025-38557 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/hid/hid-apple.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/ba08cc6801ec5fb98f2d02b5f0c614c931845325 https://git.kernel.org/stable/c/7e15d1eaa88179c5185e57a38ab05fe852d0cb8d https://git.kernel.org/stable/c/00896c3f41cb6b74fec853386076115ba50baf0a https://git.kernel.org/stable/c/1bb3363da862e0464ec050eea2fb5472a36ad86b