Skip to contentSkip to conversation

net: netlink: catch attempts to send empty messages

PATCH Applied Jakub Kicinski 3 participants 3 messages Dec 18, 2024 – Dec 20, 2024

Subsystems (2)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 net: netlink: catch attempts to send empty messages

syzbot can figure out a way to redirect a netlink message to a tap. Sending empty skbs to devices is not valid and we end up hitting a skb_assert_len() in __dev_queue_xmit().

Make catching these mistakes easier, assert the skb size directly in netlink core.

---
 net/netlink/af_netlink.c | 1 +
 1 file changed, 1 insertion(+)
net/netlink/af_netlink.c +1 -0
index f4e7b5e4bb59..85311226183a 100644
@@ -1287,6 +1287,7 @@ static struct sk_buff *netlink_trim(struct sk_buff *skb, gfp_t allocation)
 {
 	int delta;
 
+	skb_assert_len(skb);
 	WARN_ON(skb->sk != NULL);
 	delta = skb->end - skb->tail;
 	if (is_vmalloc_addr(skb->head) || delta * 2 < skb->truesize)
Signature · 1 line
2.47.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Jakub Kicinski

syzbot can figure out a way to redirect a netlink message to a tap. Sending empty skbs to devices is not valid and we end up hitting a skb_assert_len() in __dev_queue_xmit().

Make catching these mistakes easier, assert the skb size directly in netlink core.

#2 lore raw
In reply to Jakub Kicinski
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Tue, 17 Dec 2024 18:44:00 -0800 you wrote:

syzbot can figure out a way to redirect a netlink message to a tap. Sending empty skbs to devices is not valid and we end up hitting a skb_assert_len() in __dev_queue_xmit().

Make catching these mistakes easier, assert the skb size directly in netlink core.

[...]

Here is the summary with links:
- [net-next] net: netlink: catch attempts to send empty messages

    https://git.kernel.org/netdev/net-next/c/75e2c86c7b18

You are awesome, thank you!

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