From b7b9268c0604822529d804019fea66624f66633d Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 4 Jul 2022 16:37:43 +0200 Subject: [PATCH] 5.18-stable patches added patches: net-tun-avoid-disabling-napi-twice.patch --- .../net-tun-avoid-disabling-napi-twice.patch | 41 +++++++++++++++++++ queue-5.18/series | 1 + 2 files changed, 42 insertions(+) create mode 100644 queue-5.18/net-tun-avoid-disabling-napi-twice.patch diff --git a/queue-5.18/net-tun-avoid-disabling-napi-twice.patch b/queue-5.18/net-tun-avoid-disabling-napi-twice.patch new file mode 100644 index 00000000000..c8e34aee528 --- /dev/null +++ b/queue-5.18/net-tun-avoid-disabling-napi-twice.patch @@ -0,0 +1,41 @@ +From ff1fa2081d173b01cebe2fbf0a2d0f1cee9ce4b5 Mon Sep 17 00:00:00 2001 +From: Jakub Kicinski +Date: Wed, 29 Jun 2022 11:19:10 -0700 +Subject: net: tun: avoid disabling NAPI twice + +From: Jakub Kicinski + +commit ff1fa2081d173b01cebe2fbf0a2d0f1cee9ce4b5 upstream. + +Eric reports that syzbot made short work out of my speculative +fix. Indeed when queue gets detached its tfile->tun remains, +so we would try to stop NAPI twice with a detach(), close() +sequence. + +Alternative fix would be to move tun_napi_disable() to +tun_detach_all() and let the NAPI run after the queue +has been detached. + +Fixes: a8fc8cb5692a ("net: tun: stop NAPI when detaching queues") +Reported-by: syzbot +Reported-by: Eric Dumazet +Reviewed-by: Eric Dumazet +Link: https://lore.kernel.org/r/20220629181911.372047-1-kuba@kernel.org +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/tun.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/net/tun.c ++++ b/drivers/net/tun.c +@@ -641,7 +641,8 @@ static void __tun_detach(struct tun_file + tun = rtnl_dereference(tfile->tun); + + if (tun && clean) { +- tun_napi_disable(tfile); ++ if (!tfile->detached) ++ tun_napi_disable(tfile); + tun_napi_del(tfile); + } + diff --git a/queue-5.18/series b/queue-5.18/series index d8fde560214..023f7c11a9b 100644 --- a/queue-5.18/series +++ b/queue-5.18/series @@ -77,3 +77,4 @@ nvmet-add-a-clear_ids-attribute-for-passthru-targets.patch ipv6-sit-fix-ipip6_tunnel_get_prl-return-value.patch ipv6-fix-lockdep-splat-in-in6_dump_addrs.patch mlxsw-spectrum_router-fix-rollback-in-tunnel-next-hop-init.patch +net-tun-avoid-disabling-napi-twice.patch -- 2.47.3