diff options
author | Eric Dumazet <edumazet@google.com> | 2022-11-17 12:26:41 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-11-18 15:04:39 +0300 |
commit | fd896e38e5df2c5b68c78eee2fc425c4dcd3b4dd (patch) | |
tree | 2c644499ca3efaf491aa6c02141f8d9a7e9f29f8 /net | |
parent | 38461894838bbbebab54cbd5a5459cc8d1b6dd9b (diff) | |
download | linux-fd896e38e5df2c5b68c78eee2fc425c4dcd3b4dd.tar.xz |
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: 4ffa1d1c6842 ("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>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/dev.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index d0fb4af9a126..7627c475d991 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -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; |