Skip to content

Commit fd896e3

Browse files
edumazetdavem330
authored andcommitted
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: 4ffa1d1 ("net: adopt try_cmpxchg() in napi_{enable|disable}()") Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3846189 commit fd896e3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/core/dev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6399,9 +6399,9 @@ void napi_disable(struct napi_struct *n)
63996399

64006400
val = READ_ONCE(n->state);
64016401
do {
6402-
if (val & (NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC)) {
6402+
while (val & (NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC)) {
64036403
usleep_range(20, 200);
6404-
continue;
6404+
val = READ_ONCE(n->state);
64056405
}
64066406

64076407
new = val | NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC;

0 commit comments

Comments
 (0)