[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220623042039.2274708-1-kuba@kernel.org>
Date: Wed, 22 Jun 2022 21:20:39 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: davem@...emloft.net, edumazet@...gle.com
Cc: netdev@...r.kernel.org, pabeni@...hat.com,
Jakub Kicinski <kuba@...nel.org>,
syzbot+b75c138e9286ac742647@...kaller.appspotmail.com,
peterpenkov96@...il.com, maheshb@...gle.com
Subject: [PATCH net] net: tun: unlink NAPI from device on destruction
Syzbot found a race between tun file and device destruction.
NAPIs live in struct tun_file which can get destroyed before
the netdev so we have to del them explicitly. The current
code is missing deleting the NAPI if the queue was detached
first.
Fixes: 943170998b20 ("tun: enable NAPI for TUN/TAP driver")
Reported-by: syzbot+b75c138e9286ac742647@...kaller.appspotmail.com
Signed-off-by: Jakub Kicinski <kuba@...nel.org>
---
CC: peterpenkov96@...il.com
CC: maheshb@...gle.com
---
drivers/net/tun.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 87a635aac008..7fd0288c3789 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -727,6 +727,7 @@ static void tun_detach_all(struct net_device *dev)
sock_put(&tfile->sk);
}
list_for_each_entry_safe(tfile, tmp, &tun->disabled, next) {
+ tun_napi_del(tfile);
tun_enable_queue(tfile);
tun_queue_purge(tfile);
xdp_rxq_info_unreg(&tfile->xdp_rxq);
--
2.36.1
Powered by blists - more mailing lists