Skip to content

Commit c64c0b3

Browse files
edumazetdavem330
authored andcommitted
ipv4: provide stronger user input validation in nl_fib_input()
Alexander reported a KMSAN splat caused by reads of uninitialized field (tb_id_in) from user provided struct fib_result_nl It turns out nl_fib_input() sanity tests on user input is a bit wrong : User can pretend nlh->nlmsg_len is big enough, but provide at sendmsg() time a too small buffer. Reported-by: Alexander Potapenko <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8c290e6 commit c64c0b3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/ipv4/fib_frontend.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,8 @@ static void nl_fib_input(struct sk_buff *skb)
10831083

10841084
net = sock_net(skb->sk);
10851085
nlh = nlmsg_hdr(skb);
1086-
if (skb->len < NLMSG_HDRLEN || skb->len < nlh->nlmsg_len ||
1086+
if (skb->len < nlmsg_total_size(sizeof(*frn)) ||
1087+
skb->len < nlh->nlmsg_len ||
10871088
nlmsg_len(nlh) < sizeof(*frn))
10881089
return;
10891090

0 commit comments

Comments
 (0)