summaryrefslogtreecommitdiffstats
path: root/include/net/nexthop.h
diff options
context:
space:
mode:
authorEric Dumazet2018-04-07 22:42:38 +0200
committerDavid S. Miller2018-04-08 04:32:31 +0200
commitb1993a2de12c9e75c35729e2ffbc3a92d50c0d31 (patch)
tree1aa757b34c8cee87b9358880f36b2377322d4279 /include/net/nexthop.h
parentnetlink: fix uninit-value in netlink_sendmsg (diff)
downloadkernel-qcow2-linux-b1993a2de12c9e75c35729e2ffbc3a92d50c0d31.tar.gz
kernel-qcow2-linux-b1993a2de12c9e75c35729e2ffbc3a92d50c0d31.tar.xz
kernel-qcow2-linux-b1993a2de12c9e75c35729e2ffbc3a92d50c0d31.zip
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: 4e902c57417c ("[IPv4]: FIB configuration using struct fib_config") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: syzbot <syzkaller@googlegroups.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/nexthop.h')
-rw-r--r--include/net/nexthop.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/net/nexthop.h b/include/net/nexthop.h
index 36bb794f5cd6..902ff382a6dc 100644
--- a/include/net/nexthop.h
+++ b/include/net/nexthop.h
@@ -7,7 +7,7 @@
static inline int rtnh_ok(const struct rtnexthop *rtnh, int remaining)
{
- return remaining >= sizeof(*rtnh) &&
+ return remaining >= (int)sizeof(*rtnh) &&
rtnh->rtnh_len >= sizeof(*rtnh) &&
rtnh->rtnh_len <= remaining;
}