# CVE-2021-47082: tun: avoid double free in tun\_free\_netdev

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.25% (percentile 10, 2026-11-26)
- **CWE:** CWE-415
- **Published:** 2024-03-04T18:06:17.081Z
- **Modified:** 2026-08-05T08:45:53.877Z

## Who should check

- Anyone running Linux \>= 662ca437e714caaab855b12415d6ffd815985bc0, \< 8eb43d635950e27c29f1e9e49a23b31637f37757; \>= 662ca437e714caaab855b12415d6ffd815985bc0, \< 0c0e566f0387490d16f166808c72e9c772027681; \>= 662ca437e714caaab855b12415d6ffd815985bc0, \< a01a4e9f5dc93335c716fa4023b1901956e8c904; \>= 662ca437e714caaab855b12415d6ffd815985bc0, \< 3cb5ae77799e8ed6ec3fec0b6b4cd07f01650cc5; \>= 662ca437e714caaab855b12415d6ffd815985bc0, \< 158b515f703e75e7d68289bf4d98c664e1d632df; a81a02460bdf054ca0c60c5aed29941f7134092d; 6fc265f7a86d81e052508d03da555188f5882c3e; \>= 3.10.16, \< 3.11; \>= 3.11.5, \< 3.12
- Anyone running Linux 3.12

## Description

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

## Affected and fixed versions

- Linux: \>= 662ca437e714caaab855b12415d6ffd815985bc0, \< 8eb43d635950e27c29f1e9e49a23b31637f37757; \>= 662ca437e714caaab855b12415d6ffd815985bc0, \< 0c0e566f0387490d16f166808c72e9c772027681; \>= 662ca437e714caaab855b12415d6ffd815985bc0, \< a01a4e9f5dc93335c716fa4023b1901956e8c904; \>= 662ca437e714caaab855b12415d6ffd815985bc0, \< 3cb5ae77799e8ed6ec3fec0b6b4cd07f01650cc5; \>= 662ca437e714caaab855b12415d6ffd815985bc0, \< 158b515f703e75e7d68289bf4d98c664e1d632df; a81a02460bdf054ca0c60c5aed29941f7134092d; 6fc265f7a86d81e052508d03da555188f5882c3e; \>= 3.10.16, \< 3.11; \>= 3.11.5, \< 3.12 (cvelist)
- Linux: 3.12 (cvelist)

## Mitigation

- Upgrade Linux to 3.12 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2021-47082. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2021-47082.md
Affected: Linux >= 662ca437e714caaab855b12415d6ffd815985bc0, < 8eb43d635950e27c29f1e9e49a23b31637f37757; >= 662ca437e714caaab855b12415d6ffd815985bc0, < 0c0e566f0387490d16f166808c72e9c772027681; >= 662ca437e714caaab855b12415d6ffd815985bc0, < a01a4e9f5dc93335c716fa4023b1901956e8c904; >= 662ca437e714caaab855b12…
Fixed in: Linux 8eb43d635950e27c29f1e9e49a23b31637f37757, Linux 0c0e566f0387490d16f166808c72e9c772027681, Linux 3cb5ae77799e8ed6ec3fec0b6b4cd07f01650cc5, Linux 158b515f703e75e7d68289bf4d98c664e1d632df, Linux 3.11, Linux 3.12

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2021-47082 being exploited?

There is no confirmed exploitation: CVE-2021-47082 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.25% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2021-47082?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2021-47082?

Linux \>= 662ca437e714caaab855b12415d6ffd815985bc0, \< 8eb43d635950e27c29f1e9e49a23b31637f37757; \>= 662ca437e714caaab855b12415d6ffd815985bc0, \< 0c0e566f0387490d16f166808c72e9c772027681; \>= 662ca437e714caaab855b12415d6ffd815985bc0, \< a01a4e9f5dc93335c716fa4023b1901956e8c904; \>= 662ca437e714caaab855b12415d6ffd815985bc0, \< 3cb5ae77799e8ed6ec3fec0b6b4cd07f01650cc5; \>= 662ca437e714caaab855b12415d6ffd815985bc0, \< 158b515f703e75e7d68289bf4d98c664e1d632df; a81a02460bdf054ca0c60c5aed29941f7134092d; 6fc265f7a86d81e052508d03da555188f5882c3e; \>= 3.10.16, \< 3.11; \>= 3.11.5, \< 3.12; Linux 3.12.

### Is there a fix for CVE-2021-47082?

Yes. Fixed in Linux 8eb43d635950e27c29f1e9e49a23b31637f37757, Linux 0c0e566f0387490d16f166808c72e9c772027681, Linux 3cb5ae77799e8ed6ec3fec0b6b4cd07f01650cc5, Linux 158b515f703e75e7d68289bf4d98c664e1d632df, Linux 3.11, Linux 3.12. Upgrade Linux to 3.12 or later.

### How do I check if I'm affected by CVE-2021-47082?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/8eb43d635950e27c29f1e9e49a23b31637f37757>
- patch: <https://git.kernel.org/stable/c/0c0e566f0387490d16f166808c72e9c772027681>
- patch: <https://git.kernel.org/stable/c/a01a4e9f5dc93335c716fa4023b1901956e8c904>
- patch: <https://git.kernel.org/stable/c/3cb5ae77799e8ed6ec3fec0b6b4cd07f01650cc5>
- patch: <https://git.kernel.org/stable/c/158b515f703e75e7d68289bf4d98c664e1d632df>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2021-47082>

HTML: <https://flawdb.com/CVE-2021-47082> · JSON: <https://flawdb.com/api/v1/entries/CVE-2021-47082>
