# CVE-2025-21729: wifi: rtw89: fix race between cancel\_hw\_scan and hw\_scan completion

> 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.30% (percentile 15, 2026-11-26)
- **CWE:** CWE-416
- **Published:** 2025-02-27T02:07:34.711Z
- **Modified:** 2026-10-30T13:17:52.153Z

## Who should check

- Anyone running Linux \>= 895907779752606f6a4795abfc008509f8e38314, \< 02d78fb7fa1f4f4d6ecc6034e81c6db38385ce96; \>= 895907779752606f6a4795abfc008509f8e38314, \< 7368f88b2e62d043cd64fe7bdd5c3c2a2f9795b0; \>= 895907779752606f6a4795abfc008509f8e38314, \< 2403cb3c235d5e339b580cc3a825493769fadca8; \>= 895907779752606f6a4795abfc008509f8e38314, \< 5afcd6fcd1e1c1fd6bcc9a360c121d10eddade67; \>= 895907779752606f6a4795abfc008509f8e38314, \< ba4bb0402c60e945c4c396c51f0acac3c3e3ea5c
- Anyone running Linux 5.18

## Description

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

wifi: rtw89: fix race between cancel\_hw\_scan and hw\_scan completion

The rtwdev-\>scanning flag isn't protected by mutex originally, so
cancel\_hw\_scan can pass the condition, but suddenly hw\_scan completion
unset the flag and calls ieee80211\_scan\_completed() that will free
local-\>hw\_scan\_req. Then, cancel\_hw\_scan raises null-ptr-deref and
use-after-free. Fix it by moving the check condition to where
protected by mutex.

 KASAN: null-ptr-deref in range \[0x0000000000000088-0x000000000000008f\]
 CPU: 2 PID: 6922 Comm: kworker/2:2 Tainted: G           OE
 Hardware name: LENOVO 2356AD1/2356AD1, BIOS G7ETB6WW (2.76 ) 09/10/2019
 Workqueue: events cfg80211\_conn\_work \[cfg80211\]
 RIP: 0010:rtw89\_fw\_h2c\_scan\_offload\_be+0xc33/0x13c3 \[rtw89\_core\]
 Code: 00 45 89 6c 24 1c 0f 85 23 01 00 00 48 8b 85 20 ff ff ff 48 8d
 RSP: 0018:ffff88811fd9f068 EFLAGS: 00010206
 RAX: dffffc0000000000 RBX: ffff88811fd9f258 RCX: 0000000000000001
 RDX: 0000000000000011 RSI: 0000000000000001 RDI: 0000000000000089
 RBP: ffff88811fd9f170 R08: 0000000000000000 R09: 0000000000000000
 R10: ffff88811fd9f108 R11: 0000000000000000 R12: ffff88810e47f960
 R13: 0000000000000000 R14: 000000000000ffff R15: 0000000000000000
 FS:  0000000000000000(0000) GS:ffff8881d6f00000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 00007531dfca55b0 CR3: 00000001be296004 CR4: 00000000001706e0
 Call Trace:
  \<TASK\>
  ? show\_regs+0x61/0x73
  ? \_\_die\_body+0x20/0x73
  ? die\_addr+0x4f/0x7b
  ? exc\_general\_protection+0x191/0x1db
  ? asm\_exc\_general\_protection+0x27/0x30
  ? rtw89\_fw\_h2c\_scan\_offload\_be+0xc33/0x13c3 \[rtw89\_core\]
  ? rtw89\_fw\_h2c\_scan\_offload\_be+0x458/0x13c3 \[rtw89\_core\]
  ? \_\_pfx\_rtw89\_fw\_h2c\_scan\_offload\_be+0x10/0x10 \[rtw89\_core\]
  ? do\_raw\_spin\_lock+0x75/0xdb
  ? \_\_pfx\_do\_raw\_spin\_lock+0x10/0x10
  rtw89\_hw\_scan\_offload+0xb5e/0xbf7 \[rtw89\_core\]
  ? \_raw\_spin\_unlock+0xe/0x24
  ? \_\_mutex\_lock.constprop.0+0x40c/0x471
  ? \_\_pfx\_rtw89\_hw\_scan\_offload+0x10/0x10 \[rtw89\_core\]
  ? \_\_mutex\_lock\_slowpath+0x13/0x1f
  ? mutex\_lock+0xa2/0xdc
  ? \_\_pfx\_mutex\_lock+0x10/0x10
  rtw89\_hw\_scan\_abort+0x58/0xb7 \[rtw89\_core\]
  rtw89\_ops\_cancel\_hw\_scan+0x120/0x13b \[rtw89\_core\]
  ieee80211\_scan\_cancel+0x468/0x4d0 \[mac80211\]
  ieee80211\_prep\_connection+0x858/0x899 \[mac80211\]
  ieee80211\_mgd\_auth+0xbea/0xdde \[mac80211\]
  ? \_\_pfx\_ieee80211\_mgd\_auth+0x10/0x10 \[mac80211\]
  ? cfg80211\_find\_elem+0x15/0x29 \[cfg80211\]
  ? is\_bss+0x1b7/0x1d7 \[cfg80211\]
  ieee80211\_auth+0x18/0x27 \[mac80211\]
  cfg80211\_mlme\_auth+0x3bb/0x3e7 \[cfg80211\]
  cfg80211\_conn\_do\_work+0x410/0xb81 \[cfg80211\]
  ? \_\_pfx\_cfg80211\_conn\_do\_work+0x10/0x10 \[cfg80211\]
  ? \_\_kasan\_check\_read+0x11/0x1f
  ? psi\_group\_change+0x8bc/0x944
  ? \_\_kasan\_check\_write+0x14/0x22
  ? mutex\_lock+0x8e/0xdc
  ? \_\_pfx\_mutex\_lock+0x10/0x10
  ? \_\_pfx\_\_\_radix\_tree\_lookup+0x10/0x10
  cfg80211\_conn\_work+0x245/0x34d \[cfg80211\]
  ? \_\_pfx\_cfg80211\_conn\_work+0x10/0x10 \[cfg80211\]
  ? update\_cfs\_rq\_load\_avg+0x3bc/0x3d7
  ? sched\_clock\_noinstr+0x9/0x1a
  ? sched\_clock+0x10/0x24
  ? sched\_clock\_cpu+0x7e/0x42e
  ? newidle\_balance+0x796/0x937
  ? \_\_pfx\_sched\_clock\_cpu+0x10/0x10
  ? \_\_pfx\_newidle\_balance+0x10/0x10
  ? \_\_kasan\_check\_read+0x11/0x1f
  ? psi\_group\_change+0x8bc/0x944
  ? \_raw\_spin\_unlock+0xe/0x24
  ? raw\_spin\_rq\_unlock+0x47/0x54
  ? raw\_spin\_rq\_unlock\_irq+0x9/0x1f
  ? finish\_task\_switch.isra.0+0x347/0x586
  ? \_\_schedule+0x27bf/0x2892
  ? mutex\_unlock+0x80/0xd0
  ? do\_raw\_spin\_lock+0x75/0xdb
  ? \_\_pfx\_\_\_schedule+0x10/0x10
  process\_scheduled\_works+0x58c/0x821
  worker\_thread+0x4c7/0x586
  ? \_\_kasan\_check\_read+0x11/0x1f
  kthread+0x285/0x294
  ? \_\_pfx\_worker\_thread+0x10/0x10
  ? \_\_pfx\_kthread+0x10/0x10
  ret\_from\_fork+0x29/0x6f
  ? \_\_pfx\_kthread+0x10/0x10
  ret\_from\_fork\_asm+0x1b/0x30
  \</TASK\>

## Affected and fixed versions

- Linux: \>= 895907779752606f6a4795abfc008509f8e38314, \< 02d78fb7fa1f4f4d6ecc6034e81c6db38385ce96; \>= 895907779752606f6a4795abfc008509f8e38314, \< 7368f88b2e62d043cd64fe7bdd5c3c2a2f9795b0; \>= 895907779752606f6a4795abfc008509f8e38314, \< 2403cb3c235d5e339b580cc3a825493769fadca8; \>= 895907779752606f6a4795abfc008509f8e38314, \< 5afcd6fcd1e1c1fd6bcc9a360c121d10eddade67; \>= 895907779752606f6a4795abfc008509f8e38314, \< ba4bb0402c60e945c4c396c51f0acac3c3e3ea5c (cvelist)
- Linux: 5.18 (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2025-21729.md
Affected: Linux >= 895907779752606f6a4795abfc008509f8e38314, < 02d78fb7fa1f4f4d6ecc6034e81c6db38385ce96; >= 895907779752606f6a4795abfc008509f8e38314, < 7368f88b2e62d043cd64fe7bdd5c3c2a2f9795b0; >= 895907779752606f6a4795abfc008509f8e38314, < 2403cb3c235d5e339b580cc3a825493769fadca8; >= 895907779752606f6a4795a…
Fixed in: Linux 02d78fb7fa1f4f4d6ecc6034e81c6db38385ce96, Linux 7368f88b2e62d043cd64fe7bdd5c3c2a2f9795b0, Linux 2403cb3c235d5e339b580cc3a825493769fadca8, Linux 5afcd6fcd1e1c1fd6bcc9a360c121d10eddade67

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-2025-21729 being exploited?

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

### How serious is CVE-2025-21729?

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

### Which versions are affected by CVE-2025-21729?

Linux \>= 895907779752606f6a4795abfc008509f8e38314, \< 02d78fb7fa1f4f4d6ecc6034e81c6db38385ce96; \>= 895907779752606f6a4795abfc008509f8e38314, \< 7368f88b2e62d043cd64fe7bdd5c3c2a2f9795b0; \>= 895907779752606f6a4795abfc008509f8e38314, \< 2403cb3c235d5e339b580cc3a825493769fadca8; \>= 895907779752606f6a4795abfc008509f8e38314, \< 5afcd6fcd1e1c1fd6bcc9a360c121d10eddade67; \>= 895907779752606f6a4795abfc008509f8e38314, \< ba4bb0402c60e945c4c396c51f0acac3c3e3ea5c; Linux 5.18.

### Is there a fix for CVE-2025-21729?

Yes. Fixed in Linux 02d78fb7fa1f4f4d6ecc6034e81c6db38385ce96, Linux 7368f88b2e62d043cd64fe7bdd5c3c2a2f9795b0, Linux 2403cb3c235d5e339b580cc3a825493769fadca8, Linux 5afcd6fcd1e1c1fd6bcc9a360c121d10eddade67. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2025-21729?

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/2403cb3c235d5e339b580cc3a825493769fadca8>
- patch: <https://git.kernel.org/stable/c/5afcd6fcd1e1c1fd6bcc9a360c121d10eddade67>
- patch: <https://git.kernel.org/stable/c/ba4bb0402c60e945c4c396c51f0acac3c3e3ea5c>
- other: <https://git.kernel.org/stable/c/02d78fb7fa1f4f4d6ecc6034e81c6db38385ce96>
- other: <https://git.kernel.org/stable/c/7368f88b2e62d043cd64fe7bdd5c3c2a2f9795b0>

## 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-2025-21729>

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