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

2020-12-24 Thread weichenchen
random delay instead which avoids potential division by zero. Signed-off-by: weichenchen --- V4: - Use prandom_u32_max() to get a random delay in pneigh_enqueue(). V3: - Callers need to pass the delay time to pneigh_enqueue() now and they should guarantee it is not zero

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

2020-12-22 Thread weichenchen
delay time passed in by the callers and the callers guarantee it is not zero. Signed-off-by: weichenchen --- V3: - Callers need to pass the delay time to pneigh_enqueue() now and they should guarantee it is not zero. - Use READ_ONCE() to read NEIGH_VAR(p, PROXY_DELAY) in both of

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

2020-12-21 Thread weichenchen
, PROXY_DELAY) in pneigh_enqueue() to ensure not to take zero as modulus. Signed-off-by: weichenchen --- V2: - Use READ_ONCE() to prevent the complier from re-reading NEIGH_VAR(p, PROXY_DELAY). - Give a hint to the complier that delay <= 0 is unlikely to happen. Note: I don'

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

2020-12-17 Thread weichenchen
, PROXY_DELAY) in pneigh_enqueue() to ensure not to take zero as modulus. Signed-off-by: weichenchen --- net/core/neighbour.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 9500d28a43b0..eb5d015c53d3 100644 --- a/net/core