Skip to contentSkip to conversation

pull request: batman-adv 2025-09-01

PATCH Applied Simon Wunderlich 3 participants 4 messages Sep 1, 2025

Subsystems (4)
lore
Share & tools
lore

Simon Wunderlich

author maintainer
#0 lore raw

cover pull request: batman-adv 2025-09-01

Hi David, hi Jakub,

here is a bugfix for batman-adv which we would like to have integrated into net.

Please pull or let me know of any problem!

Thank you,
Simon

The following changes since commit 6439a0e64c355d2e375bd094f365d56ce81faba3:

Merge tag 'net-6.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net (2025-08-21 13:51:15 -0400)

are available in the Git repository at:

git+ssh://[email protected]/linux-merge.git tags/batadv-net-pullrequest-20250901

for you to fetch changes up to d77b6ff0ce35a6d0b0b7b9581bc3f76d041d4087:

batman-adv: fix OOB read/write in network-coding decode (2025-08-31 17:01:35 +0200)

----------------------------------------------------------------
Here is a batman-adv bugfix:

- fix OOB read/write in network-coding decode, by Stanislav Fort

----------------------------------------------------------------
Stanislav Fort (1):
batman-adv: fix OOB read/write in network-coding decode

 net/batman-adv/network-coding.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
author maintainer
#1 lore raw

PATCH 1/1 batman-adv: fix OOB read/write in network-coding decode

From: Stanislav Fort <[email protected]>

batadv_nc_skb_decode_packet() trusts coded_len and checks only against skb->len. XOR starts at sizeof(struct batadv_unicast_packet), reducing payload headroom, and the source skb length is not verified, allowing an out-of-bounds read and a small out-of-bounds write.

Validate that coded_len fits within the payload area of both destination and source sk_buffs before XORing.

Fixes 2df5278b0267 ("batman-adv: network coding - receive coded packets and decode them")
---
 net/batman-adv/network-coding.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
net/batman-adv/network-coding.c +6 -1
index 9f56308779cc3..af97d077369f9 100644
@@ -1687,7 +1687,12 @@ batadv_nc_skb_decode_packet(struct batadv_priv *bat_priv, struct sk_buff *skb,
 
 	coding_len = ntohs(coded_packet_tmp.coded_len);
 
-	if (coding_len > skb->len)
+	/* ensure dst buffer is large enough (payload only) */
+	if (coding_len + h_size > skb->len)
+		return NULL;
+
+	/* ensure src buffer is large enough (payload only) */
+	if (coding_len + h_size > nc_packet->skb->len)
 		return NULL;
 
 	/* Here the magic is reversed:
Signature · 1 line
2.47.2
#2 lore raw

Re: [PATCH net 1/1] batman-adv: fix OOB read/write in network-coding decode

This patch was applied to netdev/net.git (main) by Simon Wunderlich <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Simon Wunderlich <[email protected]>:

Quoted 8 lines · On Mon, 1 Sep 2025 18:15:46 +0200 you wrote:

From: Stanislav Fort <[email protected]>

batadv_nc_skb_decode_packet() trusts coded_len and checks only against skb->len. XOR starts at sizeof(struct batadv_unicast_packet), reducing payload headroom, and the source skb length is not verified, allowing an out-of-bounds read and a small out-of-bounds write.

[...]

Here is the summary with links:
- [net,1/1] batman-adv: fix OOB read/write in network-coding decode

    https://git.kernel.org/netdev/net/c/d77b6ff0ce35

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html