# CVE-2022-49607: linux: In the Linux kernel, the following vulnerability has been resolved:  perf/core: Fix data race between perf_event_set_...

CVE-2022-49607 is fixed in linux on 1 platform, first by DEBIAN-CVE-2022-49607, released February 26, 2025. It is not reported as exploited. Patch Radar priority: Routine.

- Web page: https://patchblox.com/security/cve/CVE-2022-49607
- Priority: Routine
- CVSS: 4.7 (medium)
- EPSS: 0.0019
- CISA KEV: not listed
- Exploited (vendor report): no
- Publicly disclosed: no
- Published: Feb 26, 2025

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

## Where it's fixed

| Platform | Product | Fixed in | Fix | Released |
|---|---|---|---|---|
| Linux | linux Debian 12.15 (bookworm) | 5.18.16-1 | [DEBIAN-CVE-2022-49607](https://patchblox.com/security/data/fix/linux/debian-cve-2022-49607.md) | Feb 26, 2025 |
| Linux | linux Debian 13.5 (trixie) | 5.18.16-1 | [DEBIAN-CVE-2022-49607](https://patchblox.com/security/data/fix/linux/debian-cve-2022-49607.md) | Feb 26, 2025 |
| Linux | linux Debian 14 | 5.18.16-1 | [DEBIAN-CVE-2022-49607](https://patchblox.com/security/data/fix/linux/debian-cve-2022-49607.md) | Feb 26, 2025 |

---

Data as of 2026-11-08T06:59:42Z UTC. Source: Patchblox Patch Radar (https://patchblox.com/security/patch-radar). Patchblox finds out-of-date software on Windows, macOS and Linux and updates it through release rings: https://patchblox.com/demo

Free to use with attribution: show "Data: Patchblox Patch Radar" with a link to https://patchblox.com/security/patch-radar. Terms, including what needs a written agreement: https://patchblox.com/security/patch-radar/use-the-data

Product names, logos and trademarks shown on Patch Radar belong to their respective owners. They are used only to identify the software each security fix applies to and to help readers find their platform. Their use does not imply any affiliation with, or endorsement by, those owners, and Patchblox is not affiliated with any of them.
