diff options
author | Eric Dumazet <edumazet@google.com> | 2018-04-07 13:42:38 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-05-16 10:08:41 +0200 |
commit | a3cac7e26bbd944cc8bfc96c81d6784fbde594ec (patch) | |
tree | 3525762b0118ea9dd3f49ff990ed45ca4caf3d5c /include | |
parent | 473ac55c5e036a73455bfbf5bf7b7bffeac4fa3d (diff) | |
download | linux-stable-a3cac7e26bbd944cc8bfc96c81d6784fbde594ec.tar.gz linux-stable-a3cac7e26bbd944cc8bfc96c81d6784fbde594ec.tar.bz2 linux-stable-a3cac7e26bbd944cc8bfc96c81d6784fbde594ec.zip |
net: fix rtnh_ok()
commit b1993a2de12c9e75c35729e2ffbc3a92d50c0d31 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/nexthop.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/net/nexthop.h b/include/net/nexthop.h index 3334dbfa5aa4..7fc78663ec9d 100644 --- a/include/net/nexthop.h +++ b/include/net/nexthop.h @@ -6,7 +6,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; } |