Skip to contentSkip to conversation

perf/x86: Fix NULL dereference in handle_pmi_common()

PATCH New Tinu K Cheriya 1 participant 1 message Dec 12, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf/x86: Fix NULL dereference in handle_pmi_common()

syzbot reported a NULL pointer dereference in handle_pmi_common() when the event pointer retrieved from cpuc->events[] is NULL but is_pebs_counter_event_group() is called unconditionally.

Add a defensive NULL check before calling is_pebs_counter_event_group().

bug:220855

---
 arch/x86/events/intel/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/intel/core.c +1 -1
index 1e3ce060d..ee693946d 100644
@@ -3397,7 +3397,7 @@ static int handle_pmi_common(struct pt_regs *regs, u64 status)
 		 *
 		 * The PEBS buffer has to be drained before handling the A-PMI
 		 */
-		if(!event)
+		if (!event)
 			continue;
 		if (is_pebs_counter_event_group(event))
 			static_call(x86_pmu_drain_pebs)(regs, &data);
Signature · 1 line
2.34.1