Skip to content

Commit b1993a2

Browse files
edumazetdavem330
authored andcommitted
net: fix rtnh_ok()
syzbot reported : BUG: KMSAN: uninit-value in rtnh_ok include/net/nexthop.h:11 [inline] BUG: KMSAN: uninit-value in fib_count_nexthops net/ipv4/fib_semantics.c:469 [inline] BUG: KMSAN: uninit-value in fib_create_info+0x554/0x8d20 net/ipv4/fib_semantics.c:1091 @Remaining is an integer, coming from user space. If it is negative we want rtnh_ok() to return false. Fixes: 4e902c5 ("[IPv4]: FIB configuration using struct fib_config") Signed-off-by: Eric Dumazet <[email protected]> Reported-by: syzbot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6091f09 commit b1993a2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/net/nexthop.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
static inline int rtnh_ok(const struct rtnexthop *rtnh, int remaining)
99
{
10-
return remaining >= sizeof(*rtnh) &&
10+
return remaining >= (int)sizeof(*rtnh) &&
1111
rtnh->rtnh_len >= sizeof(*rtnh) &&
1212
rtnh->rtnh_len <= remaining;
1313
}

0 commit comments

Comments
 (0)