Subject: perf: Treat attr.config as u64 in perf_swevent_init()
From: Tommi Rantala <tt.rantala@xxxxxxxxx>
Date: Sat, 13 Apr 2013 22:49:14 +0300

From: Tommi Rantala <tt.rantala@xxxxxxxxx>

commit 8176cced706b5e5d15887584150764894e94e02f upstream.

Trinity discovered that we fail to check all 64 bits of
attr.config passed by user space, resulting to out-of-bounds
access of the perf_swevent_enabled array in
sw_perf_event_destroy().

Introduced in commit b0a873ebb ("perf: Register PMU implementations").

Index: b/kernel/events/core.c
===================================================================
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -5340,7 +5340,7 @@ static void sw_perf_event_destroy(struct
 
 static int perf_swevent_init(struct perf_event *event)
 {
-	int event_id = event->attr.config;
+	u64 event_id = event->attr.config;
 
 	if (event->attr.type != PERF_TYPE_SOFTWARE)
 		return -ENOENT;