Re: [PATCH v2] net: neighbor: fix a crash caused by mod zero

2020-12-21 Thread Jakub Kicinski
On Mon, 21 Dec 2020 21:07:44 +0800 weichenchen wrote: > 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

[PATCH v2] net: neighbor: fix a crash caused by mod zero

2020-12-21 Thread weichenchen
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 double-checks NEIGH_VAR(p, PROXY