[PATCH] perf: Extend attr check to allow also dynamically generatedtypes

From: Robert Richter
Date: Tue Jul 05 2011 - 05:04:39 EST


When attaching events to a pmu with generated type, the initialization
fails. Extending the check to allow such types.

Signed-off-by: Robert Richter <robert.richter@xxxxxxx>
---
kernel/events/core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index cca3588..5900729 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -5958,7 +5958,7 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr,
* If the type exists, the corresponding creation will verify
* the attr->config.
*/
- if (attr->type >= PERF_TYPE_MAX)
+ if (attr->type >= PERF_TYPE_MAX && !idr_find(&pmu_idr, attr->type))
return -EINVAL;

if (attr->__reserved_1)
--
1.7.5.3




--
Advanced Micro Devices, Inc.
Operating System Research Center

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/