Skip to content

Commit 75e2c86

Browse files
committed
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. Reviewed-by: Eric Dumazet <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 3fc87cb commit 75e2c86

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/netlink/af_netlink.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,7 @@ static struct sk_buff *netlink_trim(struct sk_buff *skb, gfp_t allocation)
12871287
{
12881288
int delta;
12891289

1290+
skb_assert_len(skb);
12901291
WARN_ON(skb->sk != NULL);
12911292
delta = skb->end - skb->tail;
12921293
if (is_vmalloc_addr(skb->head) || delta * 2 < skb->truesize)

0 commit comments

Comments
 (0)