net: fix napi_disable() logic error
Subsystems (2)
PATCH 1/1 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.
--- net/core/dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/dev.c +2 -2
@@ -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;
Signature · 1 line
2.38.1.431.g37b22c650d-goog
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Quoted 9 lines · On Thu, 17 Nov 2022 09:26:41 +0000 you wrote:
Dan reported a new warning after my recent patch:
New smatch warnings:
net/core/dev.c:6409napi_disable()error: uninitialized symbol 'new'.Indeed, we must first wait for
STATE_SCHEDandSTATE_NPSVCto be cleared, to make sure @new variable has been initialized properly.[...]
Here is the summary with links:
- [net-next] net: fix napi_disable() logic error
https://git.kernel.org/netdev/net-next/c/fd896e38e5df
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html