diff options
author | weichenchen <weichen.chen@linux.alibaba.com> | 2020-12-25 08:44:45 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-12-29 01:49:48 +0300 |
commit | a533b70a657c03137dd49cbcfee70aac086ab2b1 (patch) | |
tree | ec36cd2b1aaea81ad270c0bb939a083d8a47829a /include/net/red.h | |
parent | 21fdca22eb7df2a1e194b8adb812ce370748b733 (diff) | |
download | linux-a533b70a657c03137dd49cbcfee70aac086ab2b1.tar.xz |
net: neighbor: fix a crash caused by mod zero
pneigh_enqueue() tries to obtain a random delay by mod
NEIGH_VAR(p, PROXY_DELAY). However, NEIGH_VAR(p, PROXY_DELAY)
migth be zero at that point because someone could write zero
to /proc/sys/net/ipv4/neigh/[device]/proxy_delay after the
callers check it.
This patch uses prandom_u32_max() to get a random delay instead
which avoids potential division by zero.
Signed-off-by: weichenchen <weichen.chen@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/red.h')
0 files changed, 0 insertions, 0 deletions