Skip to content

Commit

Permalink
net: fix napi_disable() logic error
Browse files Browse the repository at this point in the history
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: 4ffa1d1 ("net: adopt try_cmpxchg() in napi_{enable|disable}()")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Nov 18, 2022
1 parent 3846189 commit fd896e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -6399,9 +6399,9 @@ void napi_disable(struct napi_struct *n)

val = READ_ONCE(n->state);
do {
if (val & (NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC)) {
while (val & (NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC)) {
usleep_range(20, 200);
continue;
val = READ_ONCE(n->state);
}

new = val | NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC;
Expand Down

0 comments on commit fd896e3

Please sign in to comment.