# CVE-2022-49607: perf/core: Fix data race between perf\_event\_set\_output() and perf\_mmap\_close()

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

- **Severity:** MEDIUM 4.7
- **CVSS:** 4.7 (v3.1, CNA) `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: High; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; 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.19% (percentile 5, 2026-11-26)
- **CWE:** CWE-362
- **Published:** 2025-02-26T02:23:31.823Z
- **Modified:** 2026-06-17T05:18:36.740Z

## Who should check

- Anyone running Linux \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< 3bbd868099287ff9027db59029b502fcfa2202a0; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< f836f9ac95df15f1e0af4beb0ec20021e8c91998; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< 17f5417194136517ee9bbd6511249e5310e5617c; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< 98c3c8fd0d4c560e0f8335b79c407bbf7fc9462c; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< 43128b3eee337824158f34da6648163d2f2fb937; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< da3c256e2d0ebc87c7db0c605c9692b6f1722074; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< a9391ff7a7c5f113d6f2bf6621d49110950de49c; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< 68e3c69803dada336893640110cb87221bb01dcf; 2487f0db30527032c4d56fc2d0b1a240fe89fef8; 703197b61d05f5edae54bad3256901c5a5c8794c; …
- Anyone running Linux 3.10

## Description

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

perf/core: Fix data race between perf\_event\_set\_output() and perf\_mmap\_close()

Yang Jihing reported a race between perf\_event\_set\_output() and
perf\_mmap\_close():

	CPU1					CPU2

	perf\_mmap\_close(e2)
	  if (atomic\_dec\_and\_test(&e2-\>rb-\>mmap\_count)) // 1 - \> 0
	    detach\_rest = true

						ioctl(e1, IOC\_SET\_OUTPUT, e2)
						  perf\_event\_set\_output(e1, e2)

	  ...
	  list\_for\_each\_entry\_rcu(e, &e2-\>rb-\>event\_list, rb\_entry)
	    ring\_buffer\_attach(e, NULL);
	    // e1 isn't yet added and
	    // therefore not detached

						    ring\_buffer\_attach(e1, e2-\>rb)
						      list\_add\_rcu(&e1-\>rb\_entry,
								   &e2-\>rb-\>event\_list)

After this; e1 is attached to an unmapped rb and a subsequent
perf\_mmap() will loop forever more:

	again:
		mutex\_lock(&e-\>mmap\_mutex);
		if (event-\>rb) {
			...
			if (!atomic\_inc\_not\_zero(&e-\>rb-\>mmap\_count)) {
				...
				mutex\_unlock(&e-\>mmap\_mutex);
				goto again;
			}
		}

The loop in perf\_mmap\_close() holds e2-\>mmap\_mutex, while the attach
in perf\_event\_set\_output() holds e1-\>mmap\_mutex. As such there is no
serialization to avoid this race.

Change perf\_event\_set\_output() to take both e1-\>mmap\_mutex and
e2-\>mmap\_mutex to alleviate that problem. Additionally, have the loop
in perf\_mmap() detach the rb directly, this avoids having to wait for
the concurrent perf\_mmap\_close() to get around to doing it to make
progress.

## Affected and fixed versions

- Linux: \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< 3bbd868099287ff9027db59029b502fcfa2202a0; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< f836f9ac95df15f1e0af4beb0ec20021e8c91998; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< 17f5417194136517ee9bbd6511249e5310e5617c; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< 98c3c8fd0d4c560e0f8335b79c407bbf7fc9462c; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< 43128b3eee337824158f34da6648163d2f2fb937; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< da3c256e2d0ebc87c7db0c605c9692b6f1722074; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< a9391ff7a7c5f113d6f2bf6621d49110950de49c; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< 68e3c69803dada336893640110cb87221bb01dcf; 2487f0db30527032c4d56fc2d0b1a240fe89fef8; 703197b61d05f5edae54bad3256901c5a5c8794c; … (cvelist)
- Linux: 3.10 (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-2022-49607. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2022-49607.md
Affected: Linux >= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, < 3bbd868099287ff9027db59029b502fcfa2202a0; >= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, < f836f9ac95df15f1e0af4beb0ec20021e8c91998; >= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, < 17f5417194136517ee9bbd6511249e5310e5617c; >= 9bb5d40cd93c9dd4be74834…
Fixed in: Linux 3bbd868099287ff9027db59029b502fcfa2202a0, Linux 17f5417194136517ee9bbd6511249e5310e5617c, Linux 98c3c8fd0d4c560e0f8335b79c407bbf7fc9462c, Linux 43128b3eee337824158f34da6648163d2f2fb937, Linux 68e3c69803dada336893640110cb87221bb01dcf

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-49607 being exploited?

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

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

Medium: CVSS 4.7 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed). The attack needs conditions outside the attacker's control, which makes it harder.

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

Linux \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< 3bbd868099287ff9027db59029b502fcfa2202a0; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< f836f9ac95df15f1e0af4beb0ec20021e8c91998; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< 17f5417194136517ee9bbd6511249e5310e5617c; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< 98c3c8fd0d4c560e0f8335b79c407bbf7fc9462c; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< 43128b3eee337824158f34da6648163d2f2fb937; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< da3c256e2d0ebc87c7db0c605c9692b6f1722074; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< a9391ff7a7c5f113d6f2bf6621d49110950de49c; \>= 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b, \< 68e3c69803dada336893640110cb87221bb01dcf; 2487f0db30527032c4d56fc2d0b1a240fe89fef8; 703197b61d05f5edae54bad3256901c5a5c8794c; …; Linux 3.10.

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

Yes. Fixed in Linux 3bbd868099287ff9027db59029b502fcfa2202a0, Linux 17f5417194136517ee9bbd6511249e5310e5617c, Linux 98c3c8fd0d4c560e0f8335b79c407bbf7fc9462c, Linux 43128b3eee337824158f34da6648163d2f2fb937, Linux 68e3c69803dada336893640110cb87221bb01dcf. No fix listed yet: follow the vendor advisory.

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

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/3bbd868099287ff9027db59029b502fcfa2202a0>
- patch: <https://git.kernel.org/stable/c/f836f9ac95df15f1e0af4beb0ec20021e8c91998>
- patch: <https://git.kernel.org/stable/c/17f5417194136517ee9bbd6511249e5310e5617c>
- patch: <https://git.kernel.org/stable/c/98c3c8fd0d4c560e0f8335b79c407bbf7fc9462c>
- patch: <https://git.kernel.org/stable/c/43128b3eee337824158f34da6648163d2f2fb937>
- patch: <https://git.kernel.org/stable/c/da3c256e2d0ebc87c7db0c605c9692b6f1722074>
- patch: <https://git.kernel.org/stable/c/a9391ff7a7c5f113d6f2bf6621d49110950de49c>
- patch: <https://git.kernel.org/stable/c/68e3c69803dada336893640110cb87221bb01dcf>

## 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-49607>

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