Skip to contentSkip to conversation

tun: avoid calling xdp_rxq_info_unreg() twice

PATCH Applied Cong Wang 2 participants 2 messages Jan 22, 2018

Subsystems (3)
lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH 1/1 tun: avoid calling xdp_rxq_info_unreg() twice

Similarly to tx ring, xdp_rxq_info is only registered when !tfile->detached, so we need to avoid calling xdp_rxq_info_unreg() twice too. The helper tun_cleanup_tx_ring() already checks for this properly, so it is correct to put xdp_rxq_info_unreg() just inside there.

Reported-by [email protected]
Fixes 8565d26bcb2f ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net")
Cc Jason Wang <[email protected]>
---
 drivers/net/tun.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/tun.c +0 -2
index 2bc18b16a45b..a0c5cb1a1617 100644
@@ -774,14 +774,12 @@ static void tun_detach_all(struct net_device *dev)
 		tun_napi_del(tun, tfile);
 		/* Drop read queue */
 		tun_queue_purge(tfile);
-		xdp_rxq_info_unreg(&tfile->xdp_rxq);
 		sock_put(&tfile->sk);
 		tun_cleanup_tx_ring(tfile);
 	}
 	list_for_each_entry_safe(tfile, tmp, &tun->disabled, next) {
 		tun_enable_queue(tfile);
 		tun_queue_purge(tfile);
-		xdp_rxq_info_unreg(&tfile->xdp_rxq);
 		sock_put(&tfile->sk);
 		tun_cleanup_tx_ring(tfile);
 	}
Signature · 1 line
2.13.0
maintainer Applied
#1 lore raw

From: Cong Wang <[email protected]>
Date: Mon, 22 Jan 2018 13:49:27 -0800

Quoted 10 lines

Similarly to tx ring, xdp_rxq_info is only registered when !tfile->detached, so we need to avoid calling xdp_rxq_info_unreg() twice too. The helper tun_cleanup_tx_ring() already checks for this properly, so it is correct to put xdp_rxq_info_unreg() just inside there.

Reported-by [email protected]
Fixes 8565d26bcb2f ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net")
Cc Jason Wang <[email protected]>

I knew it! :-)

Thanks for fixing this so fast Cong.

Applied.