Commit fd896e38 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: fix napi_disable() logic error

Dan reported a new warning after my recent patch:

New smatch warnings:
net/core/dev.c:6409 napi_disable() error: uninitialized symbol 'new'.

Indeed, we must first wait for STATE_SCHED and STATE_NPSVC to be cleared,
to make sure @new variable has been initialized properly.

Fixes: 4ffa1d1c ("net: adopt try_cmpxchg() in napi_{enable|disable}()")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 38461894
...@@ -6399,9 +6399,9 @@ void napi_disable(struct napi_struct *n) ...@@ -6399,9 +6399,9 @@ void napi_disable(struct napi_struct *n)
val = READ_ONCE(n->state); val = READ_ONCE(n->state);
do { do {
if (val & (NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC)) { while (val & (NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC)) {
usleep_range(20, 200); usleep_range(20, 200);
continue; val = READ_ONCE(n->state);
} }
new = val | NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC; new = val | NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment