* CVE-2026-139182: net: tun: hold napi_mutex when deleting NAPI in tun_detach_all()
@ 2026-11-30 13:33 Greg Kroah-Hartman
0 siblings, 0 replies; only message in thread
From: Greg Kroah-Hartman @ 2026-11-30 13:33 UTC (permalink / raw)
To: linux-cve-announce; +Cc: Greg Kroah-Hartman
From: Greg Kroah-Hartman <gregkh@kernel.org>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
net: tun: hold napi_mutex when deleting NAPI in tun_detach_all()
With IFF_NAPI_FRAGS, tun_get_user() takes tfile->napi_mutex, gets the
skb from napi_get_frags() and copies the user data into it before it
enters the RCU read-side section around napi_gro_frags().
tun_detach_all() waits with synchronize_net() and then calls
tun_napi_del() without napi_mutex. netif_napi_del() frees napi->skb
through napi_free_frags(). A writer that is still copying has not yet
entered its RCU section, so synchronize_net() does not wait for it, and
deleting the device frees the skb while the writer is using it:
BUG: KASAN: slab-use-after-free in skb_copy_datagram_from_iter+0x175/0x720
Read of size 8 at addr ffff888077def990 by task br029-poc/9406
Call Trace:
skb_copy_datagram_from_iter+0x175/0x720
tun_get_user+0xb42/0x3d00
tun_chr_write_iter+0x113/0x200
...
Freed by task 9405:
kmem_cache_free+0x184/0x670
__netif_napi_del_locked+0x2bb/0x3c0
tun_net_uninit+0x566/0xa70
unregister_netdevice_many_notify+0x1a26/0x2090
rtnl_dellink+0x514/0x710
__tun_detach() also calls tun_napi_del() without the mutex, but only
from tun_chr_close(), when no write on that file can be in flight.
Take napi_mutex around tun_napi_del() in tun_detach_all() for both
attached and disabled queues.
The Linux kernel CVE team has assigned CVE-2026-139182 to this issue.
Affected and fixed versions
===========================
Issue introduced in 4.15 with commit 90e33d45940793def6f773b2d528e9f3c84ffdc7 and fixed in 5.10.275 with commit 55a9754198e1171c5797b31fe60517d58219294c
Issue introduced in 4.15 with commit 90e33d45940793def6f773b2d528e9f3c84ffdc7 and fixed in 5.15.226 with commit 50ee89b116c96f7d285633a082bc0a703bda9c7e
Issue introduced in 4.15 with commit 90e33d45940793def6f773b2d528e9f3c84ffdc7 and fixed in 6.1.193 with commit 52d9eeb9e183b8d9094afd540f360e70cea8142d
Issue introduced in 4.15 with commit 90e33d45940793def6f773b2d528e9f3c84ffdc7 and fixed in 6.6.163 with commit e3c95c73023c2ffd43b8495df9299fe03f03148f
Issue introduced in 4.15 with commit 90e33d45940793def6f773b2d528e9f3c84ffdc7 and fixed in 6.12.119 with commit b4ba1f5d3e954b62c295529436e2a6883d875027
Issue introduced in 4.15 with commit 90e33d45940793def6f773b2d528e9f3c84ffdc7 and fixed in 6.18.65 with commit ea600cb5ebe44e48ddc2b0af206e0d1d32ada839
Issue introduced in 4.15 with commit 90e33d45940793def6f773b2d528e9f3c84ffdc7 and fixed in 7.3.6 with commit f5fbedfb039cc124bfeded1afd8e58ac76b2d55d
Issue introduced in 4.15 with commit 90e33d45940793def6f773b2d528e9f3c84ffdc7 and fixed in 7.4-rc1 with commit 6c799b4998c87bb44574bb090b8728bb3b3dbc47
Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to
older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2026-139182
will be updated if fixes are backported, please check that for the most
up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
drivers/net/tun.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes. Individual
changes are never tested alone, but rather are part of a larger kernel
release. Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all. If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
https://git.kernel.org/stable/c/55a9754198e1171c5797b31fe60517d58219294c
https://git.kernel.org/stable/c/50ee89b116c96f7d285633a082bc0a703bda9c7e
https://git.kernel.org/stable/c/52d9eeb9e183b8d9094afd540f360e70cea8142d
https://git.kernel.org/stable/c/e3c95c73023c2ffd43b8495df9299fe03f03148f
https://git.kernel.org/stable/c/b4ba1f5d3e954b62c295529436e2a6883d875027
https://git.kernel.org/stable/c/ea600cb5ebe44e48ddc2b0af206e0d1d32ada839
https://git.kernel.org/stable/c/f5fbedfb039cc124bfeded1afd8e58ac76b2d55d
https://git.kernel.org/stable/c/6c799b4998c87bb44574bb090b8728bb3b3dbc47
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-30 13:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 13:33 CVE-2026-139182: net: tun: hold napi_mutex when deleting NAPI in tun_detach_all() Greg Kroah-Hartman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.