# CVE-2022-49215: xsk: Fix race at socket teardown

> 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.22% (percentile 8, 2026-11-28)
- **CWE:** CWE-362, CWE-476
- **Published:** 2025-02-26T01:55:50.154Z
- **Modified:** 2026-08-05T08:54:24.178Z

## Who should check

- Anyone running Linux \>= 42fddcc7c64b723a867c7b2f5f7505e244212f13, \< ad7219cd8751bd258b9d1e69ae0654ec00f71875; \>= 42fddcc7c64b723a867c7b2f5f7505e244212f13, \< d1579253ffce39986e7a6ab757ac93b2680a665f; \>= 42fddcc7c64b723a867c7b2f5f7505e244212f13, \< 8a2dea162b92c322f3e42eae0c4a74b8d20aa7a9; \>= 42fddcc7c64b723a867c7b2f5f7505e244212f13, \< 18b1ab7aa76bde181bdb1ab19a87fa9523c32f21
- Anyone running Linux 5.4

## Description

In the Linux kernel, the following vulnerability has been resolved:

xsk: Fix race at socket teardown

Fix a race in the xsk socket teardown code that can lead to a NULL pointer
dereference splat. The current xsk unbind code in xsk\_unbind\_dev() starts by
setting xs-\>state to XSK\_UNBOUND, sets xs-\>dev to NULL and then waits for any
NAPI processing to terminate using synchronize\_net(). After that, the release
code starts to tear down the socket state and free allocated memory.

  BUG: kernel NULL pointer dereference, address: 00000000000000c0
  PGD 8000000932469067 P4D 8000000932469067 PUD 0
  Oops: 0000 \[\#1\] PREEMPT SMP PTI
  CPU: 25 PID: 69132 Comm: grpcpp\_sync\_ser Tainted: G          I       5.16.0+ \#2
  Hardware name: Dell Inc. PowerEdge R730/0599V5, BIOS 1.2.10 03/09/2015
  RIP: 0010:\_\_xsk\_sendmsg+0x2c/0x690
  \[...\]
  RSP: 0018:ffffa2348bd13d50 EFLAGS: 00010246
  RAX: 0000000000000000 RBX: 0000000000000040 RCX: ffff8d5fc632d258
  RDX: 0000000000400000 RSI: ffffa2348bd13e10 RDI: ffff8d5fc5489800
  RBP: ffffa2348bd13db0 R08: 0000000000000000 R09: 00007ffffffff000
  R10: 0000000000000000 R11: 0000000000000000 R12: ffff8d5fc5489800
  R13: ffff8d5fcb0f5140 R14: ffff8d5fcb0f5140 R15: 0000000000000000
  FS:  00007f991cff9400(0000) GS:ffff8d6f1f700000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 00000000000000c0 CR3: 0000000114888005 CR4: 00000000001706e0
  Call Trace:
  \<TASK\>
  ? aa\_sk\_perm+0x43/0x1b0
  xsk\_sendmsg+0xf0/0x110
  sock\_sendmsg+0x65/0x70
  \_\_sys\_sendto+0x113/0x190
  ? debug\_smp\_processor\_id+0x17/0x20
  ? fpregs\_assert\_state\_consistent+0x23/0x50
  ? exit\_to\_user\_mode\_prepare+0xa5/0x1d0
  \_\_x64\_sys\_sendto+0x29/0x30
  do\_syscall\_64+0x3b/0xc0
  entry\_SYSCALL\_64\_after\_hwframe+0x44/0xae

There are two problems with the current code. First, setting xs-\>dev to NULL
before waiting for all users to stop using the socket is not correct. The
entry to the data plane functions xsk\_poll(), xsk\_sendmsg(), and xsk\_recvmsg()
are all guarded by a test that xs-\>state is in the state XSK\_BOUND and if not,
it returns right away. But one process might have passed this test but still
have not gotten to the point in which it uses xs-\>dev in the code. In this
interim, a second process executing xsk\_unbind\_dev() might have set xs-\>dev to
NULL which will lead to a crash for the first process. The solution here is
just to get rid of this NULL assignment since it is not used anymore. Before
commit 42fddcc7c64b ("xsk: use state member for socket synchronization"),
xs-\>dev was the gatekeeper to admit processes into the data plane functions,
but it was replaced with the state variable xs-\>state in the aforementioned
commit.

The second problem is that synchronize\_net() does not wait for any process in
xsk\_poll(), xsk\_sendmsg(), or xsk\_recvmsg() to complete, which means that the
state they rely on might be cleaned up prematurely. This can happen when the
notifier gets called (at driver unload for example) as it uses xsk\_unbind\_dev().
Solve this by extending the RCU critical region from just the ndo\_xsk\_wakeup
to the whole functions mentioned above, so that both the test of xs-\>state ==
XSK\_BOUND and the last use of any member of xs is covered by the RCU critical
section. This will guarantee that when synchronize\_net() completes, there will
be no processes left executing xsk\_poll(), xsk\_sendmsg(), or xsk\_recvmsg() and
state can be cleaned up safely. Note that we need to drop the RCU lock for the
skb xmit path as it uses functions that might sleep. Due to this, we have to
retest the xs-\>state after we grab the mutex that protects the skb xmit code
from, among a number of things, an xsk\_unbind\_dev() being executed from the
notifier at the same time.

## Affected and fixed versions

- Linux: \>= 42fddcc7c64b723a867c7b2f5f7505e244212f13, \< ad7219cd8751bd258b9d1e69ae0654ec00f71875; \>= 42fddcc7c64b723a867c7b2f5f7505e244212f13, \< d1579253ffce39986e7a6ab757ac93b2680a665f; \>= 42fddcc7c64b723a867c7b2f5f7505e244212f13, \< 8a2dea162b92c322f3e42eae0c4a74b8d20aa7a9; \>= 42fddcc7c64b723a867c7b2f5f7505e244212f13, \< 18b1ab7aa76bde181bdb1ab19a87fa9523c32f21 (cvelist)
- Linux: 5.4 (cvelist)

## Mitigation

- Upgrade Linux to 18b1ab7aa76bde181bdb1ab19a87fa9523c32f21 or later.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2022-49215.md
Affected: Linux >= 42fddcc7c64b723a867c7b2f5f7505e244212f13, < ad7219cd8751bd258b9d1e69ae0654ec00f71875; >= 42fddcc7c64b723a867c7b2f5f7505e244212f13, < d1579253ffce39986e7a6ab757ac93b2680a665f; >= 42fddcc7c64b723a867c7b2f5f7505e244212f13, < 8a2dea162b92c322f3e42eae0c4a74b8d20aa7a9; >= 42fddcc7c64b723a867c7b2…
Fixed in: Linux 8a2dea162b92c322f3e42eae0c4a74b8d20aa7a9, Linux 18b1ab7aa76bde181bdb1ab19a87fa9523c32f21

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-2022-49215 being exploited?

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

### How serious is CVE-2022-49215?

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

### Which versions are affected by CVE-2022-49215?

Linux \>= 42fddcc7c64b723a867c7b2f5f7505e244212f13, \< ad7219cd8751bd258b9d1e69ae0654ec00f71875; \>= 42fddcc7c64b723a867c7b2f5f7505e244212f13, \< d1579253ffce39986e7a6ab757ac93b2680a665f; \>= 42fddcc7c64b723a867c7b2f5f7505e244212f13, \< 8a2dea162b92c322f3e42eae0c4a74b8d20aa7a9; \>= 42fddcc7c64b723a867c7b2f5f7505e244212f13, \< 18b1ab7aa76bde181bdb1ab19a87fa9523c32f21; Linux 5.4.

### Is there a fix for CVE-2022-49215?

Yes. Fixed in Linux 8a2dea162b92c322f3e42eae0c4a74b8d20aa7a9, Linux 18b1ab7aa76bde181bdb1ab19a87fa9523c32f21. Upgrade Linux to 18b1ab7aa76bde181bdb1ab19a87fa9523c32f21 or later.

### How do I check if I'm affected by CVE-2022-49215?

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/ad7219cd8751bd258b9d1e69ae0654ec00f71875>
- patch: <https://git.kernel.org/stable/c/d1579253ffce39986e7a6ab757ac93b2680a665f>
- patch: <https://git.kernel.org/stable/c/8a2dea162b92c322f3e42eae0c4a74b8d20aa7a9>
- patch: <https://git.kernel.org/stable/c/18b1ab7aa76bde181bdb1ab19a87fa9523c32f21>

## 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-2022-49215>

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