CVE-2021-47082: tun: avoid double free in tun_free_netdev
In the Linux kernel, the following vulnerability has been resolved:
tun: avoid double free in tun_free_netdev
Avoid double free in tun_free_netdev() by moving the
dev->tstats and tun->security allocs to a new ndo_init routine
(tun_net_init()) that will be called by register_netdevice().
ndo_init is paired with the desctructor (tun_free_netdev()),
so if there's an error in register_netdevice() the destructor
will handle the frees.
BUG: KASAN: double-free or invalid-free in selinux_tun_dev_free_security+0x1a/0x20 security/selinux/hooks.c:5605
CPU: 0 PID: 25750 Comm: syz-executor416 Not tainted 5.16.0-rc2-syzk #1
Hardware name: Red Hat KVM, BIOS
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x89/0xb5 lib/dump_stack.c:106
print_address_description.constprop.9+0x28/0x160 mm/kasan/report.c:247
kasan_report_invalid_free+0x55/0x80 mm/kasan/report.c:372
____kasan_slab_free mm/kasan/common.c:346 [inline]
__kasan_slab_free+0x107/0x120 mm/kasan/common.c:374
kasan_slab_free include/linux/kasan.h:235 [inline]
slab_free_hook mm/slub.c:1723 [inline]
slab_free_freelist_hook mm/slub.c:1749 [inline]
slab_free mm/slub.c:3513 [inline]
kfree+0xac/0x2d0 mm/slub.c:4561
selinux_tun_dev_free_security+0x1a/0x20 security/selinux/hooks.c:5605
security_tun_dev_free_security+0x4f/0x90 security/security.c:2342
tun_free_netdev+0xe6/0x150 drivers/net/tun.c:2215
netdev_run_todo+0x4df/0x840 net/core/dev.c:10627
rtnl_unlock+0x13/0x20 net/core/rtnetlink.c:112
__tun_chr_ioctl+0x80c/0x2870 drivers/net/tun.c:3302
tun_chr_ioctl+0x2f/0x40 drivers/net/tun.c:3311
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl fs/ioctl.c:860 [inline]
__x64_sys_ioctl+0x19d/0x220 fs/ioctl.c:860
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3a/0x80 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x44/0xae
Security readout for executives and security teams
Plain-English summary
This Linux kernel flaw is a double-free bug in the TUN/TAP network driver cleanup path. The provided sources show a kernel crash found by fuzzing, but no CVSS score, named real-world attacks, or KEV listing. Treat it as a kernel stability and potential privilege-risk issue until vendor guidance confirms impact.
Executive priority
Handle through normal kernel patch governance unless your environment exposes TUN/TAP to untrusted local users or workloads. The absence of known exploitation lowers urgency, but kernel memory-management bugs should not be deferred indefinitely.
Technical view
CVE-2021-47082 affects Linux TUN driver cleanup in tun_free_netdev(). Allocations for dev->tstats and tun->security were moved into ndo_init so register_netdevice() failure paths pair correctly with the destructor. The trace shows KASAN detecting double-free or invalid-free through SELinux TUN security cleanup.
Likely exposure
Exposure is most relevant to Linux systems running affected kernel versions with TUN/TAP support. The bundle lists affected Linux versions and stable kernel fixes, but does not define exact distribution packages, privilege requirements, or reachable attack scenarios.
Exploitation context
The source bundle shows a syzkaller/KASAN crash trace and kernel stable fixes. It does not provide evidence of active exploitation, public exploit use, or CISA KEV inclusion. Exploitability and business impact remain unclear from the supplied evidence.
Researcher notes
The strongest evidence is the upstream kernel fix description and KASAN trace. Affected-version metadata is broad and partly commit-based. The bundle does not include CVSS, CWE mapping, distribution advisories, proof of exploitation, or precise prerequisites.
Mitigation direction
Check distribution kernel advisories for CVE-2021-47082 package status.
Update affected Linux kernels to a vendor-fixed build.
Prioritize systems allowing local users or services to use TUN/TAP interfaces.
Restrict unnecessary access to TUN/TAP functionality where operationally feasible.
Track kernel stable commits referenced by the CVE for backport confirmation.
Validation and detection
Inventory Linux kernel versions across servers, appliances, and images.
Compare installed kernels against vendor advisories for CVE-2021-47082.
Confirm whether TUN/TAP support is enabled on exposed systems.
Review whether untrusted workloads can request TUN/TAP devices.
Verify patched systems are running the updated kernel after reboot.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2021-47082 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.