]> git.ipfire.org Git - people/arne_f/kernel.git/commit
net: disable netpoll on fresh napis
authorJakub Kicinski <kuba@kernel.org>
Wed, 26 Aug 2020 19:40:06 +0000 (12:40 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 12 Sep 2020 11:39:12 +0000 (13:39 +0200)
commit652a9dc840fb5bf1274a43a92c76372fac7e1b25
tree72f53f623640edaf5ea5e9ef14eb8159b4bc09ee
parentb5782c68d954896ca2e783fc8c7d7f4501b1aed3
net: disable netpoll on fresh napis

[ Upstream commit 96e97bc07e90f175a8980a22827faf702ca4cb30 ]

napi_disable() makes sure to set the NAPI_STATE_NPSVC bit to prevent
netpoll from accessing rings before init is complete. However, the
same is not done for fresh napi instances in netif_napi_add(),
even though we expect NAPI instances to be added as disabled.

This causes crashes during driver reconfiguration (enabling XDP,
changing the channel count) - if there is any printk() after
netif_napi_add() but before napi_enable().

To ensure memory ordering is correct we need to use RCU accessors.

Reported-by: Rob Sherwood <rsher@fb.com>
Fixes: 2d8bff12699a ("netpoll: Close race condition between poll_one_napi and napi_disable")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/core/dev.c
net/core/netpoll.c