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 739BE306B2A for ; Fri, 5 Sep 2025 17:23:17 +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=1757092997; cv=none; b=Y7aPn1HBScNV0spGdQCSHcMRyTlKVHVwVpZyxI+Ju+iAlTq0uRd1+zp5IDEKWdkePUqfkKeAIw0rsETtk1YjmMNQXAPTf47mBwO0K77TUUlRAlCQCVfJhYxF0wtDurKDzfWQWJ4/rcffDXFlVepz3R5bRJ51Kx7WqvTu6eTFFFo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757092997; c=relaxed/simple; bh=q1EscHOQ1b907WHrm53t7b1zOcUCHLadHVFDHN/Gb1o=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=B15EBL2enxVrAGPqORaqPmGsdq8KNDjrNWkQ5YjlmdVGvpw/5ezMn0tKZlcU3PhRc2GbAkagoEqL5zZPfnVpyv9dfhcDkWXbaE2forsWcl8Wkzmxx+EiGzNBV6NG1fMip3XkD/uvggcdWDk+T7c8sslEUHpJPfy9kpTKatxNYuM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xElJSEWa; 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="xElJSEWa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB3D2C4CEF1; Fri, 5 Sep 2025 17:23:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1757092997; bh=q1EscHOQ1b907WHrm53t7b1zOcUCHLadHVFDHN/Gb1o=; h=From:To:Cc:Subject:Date:Reply-to:From; b=xElJSEWavIuHCqJ9MtWYjQEg+VjZBdTE0toVh8pWVtTc7Z2rz6eJyhm1H9c+7VBzT MTuewb6YjBjSSacl6uo5FtF4hrWum7Lkycp2Xr1uSuFN9ERxlu78+C2xcrRdcnJ4RN QmI3xrxt8+WakdkdwNWufBw+KPgPDM0IAcpszf+0= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-39703: net, hsr: reject HSR frame if skb can't hold tag Date: Fri, 5 Sep 2025 19:21:16 +0200 Message-ID: <2025090549-CVE-2025-39703-b03b@gregkh> X-Mailer: git-send-email 2.51.0 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=10053; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=WpwYN0m4wTxdoIhKsAmNO1+KypFy9wJ2/IYELQ0SihU=; b=owGbwMvMwCRo6H6F97bub03G02pJDBm7pT9O2jg1z8OEr37dJIfl3Se+zEkyOmqprxqvNSHF2 Mb8YfzLjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZjIGm6G+ekVCuatHdzRx/kN 8jyasybIslSuYViwYpLyOrnSs//DRU5cfMZRIX1oKUcPAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: net, hsr: reject HSR frame if skb can't hold tag Receiving HSR frame with insufficient space to hold HSR tag in the skb can result in a crash (kernel BUG): [ 45.390915] skbuff: skb_under_panic: text:ffffffff86f32cac len:26 put:14 head:ffff888042418000 data:ffff888042417ff4 tail:0xe end:0x180 dev:bridge_slave_1 [ 45.392559] ------------[ cut here ]------------ [ 45.392912] kernel BUG at net/core/skbuff.c:211! [ 45.393276] Oops: invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN NOPTI [ 45.393809] CPU: 1 UID: 0 PID: 2496 Comm: reproducer Not tainted 6.15.0 #12 PREEMPT(undef) [ 45.394433] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014 [ 45.395273] RIP: 0010:skb_panic+0x15b/0x1d0 [ 45.402911] Call Trace: [ 45.403105] [ 45.404470] skb_push+0xcd/0xf0 [ 45.404726] br_dev_queue_push_xmit+0x7c/0x6c0 [ 45.406513] br_forward_finish+0x128/0x260 [ 45.408483] __br_forward+0x42d/0x590 [ 45.409464] maybe_deliver+0x2eb/0x420 [ 45.409763] br_flood+0x174/0x4a0 [ 45.410030] br_handle_frame_finish+0xc7c/0x1bc0 [ 45.411618] br_handle_frame+0xac3/0x1230 [ 45.413674] __netif_receive_skb_core.constprop.0+0x808/0x3df0 [ 45.422966] __netif_receive_skb_one_core+0xb4/0x1f0 [ 45.424478] __netif_receive_skb+0x22/0x170 [ 45.424806] process_backlog+0x242/0x6d0 [ 45.425116] __napi_poll+0xbb/0x630 [ 45.425394] net_rx_action+0x4d1/0xcc0 [ 45.427613] handle_softirqs+0x1a4/0x580 [ 45.427926] do_softirq+0x74/0x90 [ 45.428196] This issue was found by syzkaller. The panic happens in br_dev_queue_push_xmit() once it receives a corrupted skb with ETH header already pushed in linear data. When it attempts the skb_push() call, there's not enough headroom and skb_push() panics. The corrupted skb is put on the queue by HSR layer, which makes a sequence of unintended transformations when it receives a specific corrupted HSR frame (with incomplete TAG). Fix it by dropping and consuming frames that are not long enough to contain both ethernet and hsr headers. Alternative fix would be to check for enough headroom before skb_push() in br_dev_queue_push_xmit(). In the reproducer, this is injected via AF_PACKET, but I don't easily see why it couldn't be sent over the wire from adjacent network. Further Details: In the reproducer, the following network interface chain is set up: ┌────────────────┐ ┌────────────────┐ │ veth0_to_hsr ├───┤ hsr_slave0 ┼───┐ └────────────────┘ └────────────────┘ │ │ ┌──────┐ ├─┤ hsr0 ├───┐ │ └──────┘ │ ┌────────────────┐ ┌────────────────┐ │ │┌────────┐ │ veth1_to_hsr ┼───┤ hsr_slave1 ├───┘ └┤ │ └────────────────┘ └────────────────┘ ┌┼ bridge │ ││ │ │└────────┘ │ ┌───────┐ │ │ ... ├──────┘ └───────┘ To trigger the events leading up to crash, reproducer sends a corrupted HSR frame with incomplete TAG, via AF_PACKET socket on 'veth0_to_hsr'. The first HSR-layer function to process this frame is hsr_handle_frame(). It and then checks if the protocol is ETH_P_PRP or ETH_P_HSR. If it is, it calls skb_set_network_header(skb, ETH_HLEN + HSR_HLEN), without checking that the skb is long enough. For the crashing frame it is not, and hence the skb->network_header and skb->mac_len fields are set incorrectly, pointing after the end of the linear buffer. I will call this a BUG#1 and it is what is addressed by this patch. In the crashing scenario before the fix, the skb continues to go down the hsr path as follows. hsr_handle_frame() then calls this sequence hsr_forward_skb() fill_frame_info() hsr->proto_ops->fill_frame_info() hsr_fill_frame_info() hsr_fill_frame_info() contains a check that intends to check whether the skb actually contains the HSR header. But the check relies on the skb->mac_len field which was erroneously setup due to BUG#1, so the check passes and the execution continues back in the hsr_forward_skb(): hsr_forward_skb() hsr_forward_do() hsr->proto_ops->get_untagged_frame() hsr_get_untagged_frame() create_stripped_skb_hsr() In create_stripped_skb_hsr(), a copy of the skb is created and is further corrupted by operation that attempts to strip the HSR tag in a call to __pskb_copy(). The skb enters create_stripped_skb_hsr() with ethernet header pushed in linear buffer. The skb_pull(skb_in, HSR_HLEN) thus pulls 6 bytes of ethernet header into the headroom, creating skb_in with a headroom of size 8. The subsequent __pskb_copy() then creates an skb with headroom of just 2 and skb->len of just 12, this is how it looks after the copy: gdb) p skb->len $10 = 12 (gdb) p skb->data $11 = (unsigned char *) 0xffff888041e45382 "\252\252\252\252\252!\210\373", (gdb) p skb->head $12 = (unsigned char *) 0xffff888041e45380 "" It seems create_stripped_skb_hsr() assumes that ETH header is pulled in the headroom when it's entered, because it just pulls HSR header on top. But that is not the case in our code-path and we end up with the corrupted skb instead. I will call this BUG#2 *I got confused here because it seems that under no conditions can create_stripped_skb_hsr() work well, the assumption it makes is not true during the processing of hsr frames - since the skb_push() in hsr_handle_frame to skb_pull in hsr_deliver_master(). I wonder whether I missed something here.* Next, the execution arrives in hsr_deliver_master(). It calls skb_pull(ETH_HLEN), which just returns NULL - the SKB does not have enough space for the pull (as it only has 12 bytes in total at this point). *The skb_pull() here further suggests that ethernet header is meant to be pushed through the whole hsr processing and create_stripped_skb_hsr() should pull it before doing the HSR header pull.* hsr_deliver_master() then puts the corrupted skb on the queue, it is then picked up from there by bridge frame handling layer and finally lands in br_dev_queue_push_xmit where it panics. The Linux kernel CVE team has assigned CVE-2025-39703 to this issue. Affected and fixed versions =========================== Issue introduced in 5.10.42 with commit f6442ee08fe66c8e45c4f246531a2aaf4f17a7a7 and fixed in 5.10.241 with commit 8d9bc4a375a1ba05f7dfa0407de8e510ab9bd14d Issue introduced in 5.13 with commit 48b491a5cc74333c4a6a82fe21cea42c055a3b0b and fixed in 5.15.190 with commit 3ae272ab523dd6bdc26e879027ed79feac9dd1b3 Issue introduced in 5.13 with commit 48b491a5cc74333c4a6a82fe21cea42c055a3b0b and fixed in 6.1.149 with commit b640188b8a6690e685939053c7efdbc7818b5f4e Issue introduced in 5.13 with commit 48b491a5cc74333c4a6a82fe21cea42c055a3b0b and fixed in 6.6.103 with commit b117c41b00902c1a7e24347c405cb82504aeae0b Issue introduced in 5.13 with commit 48b491a5cc74333c4a6a82fe21cea42c055a3b0b and fixed in 6.12.44 with commit acd69b597bd3f76d3b3d322b84082226c00eeaa4 Issue introduced in 5.13 with commit 48b491a5cc74333c4a6a82fe21cea42c055a3b0b and fixed in 6.16.4 with commit 61009439e4bd8d74e705ee15940760321be91d8a Issue introduced in 5.13 with commit 48b491a5cc74333c4a6a82fe21cea42c055a3b0b and fixed in 6.17-rc3 with commit 7af76e9d18a9fd6f8611b3313c86c190f9b6a5a7 Issue introduced in 5.12.9 with commit 4ffd1d4a6b306ff69cbe412d2c54d2dd349ff436 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-39703 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: net/hsr/hsr_slave.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/8d9bc4a375a1ba05f7dfa0407de8e510ab9bd14d https://git.kernel.org/stable/c/3ae272ab523dd6bdc26e879027ed79feac9dd1b3 https://git.kernel.org/stable/c/b640188b8a6690e685939053c7efdbc7818b5f4e https://git.kernel.org/stable/c/b117c41b00902c1a7e24347c405cb82504aeae0b https://git.kernel.org/stable/c/acd69b597bd3f76d3b3d322b84082226c00eeaa4 https://git.kernel.org/stable/c/61009439e4bd8d74e705ee15940760321be91d8a https://git.kernel.org/stable/c/7af76e9d18a9fd6f8611b3313c86c190f9b6a5a7