We don't set an error code here which means that perf_event_alloc() returns ERR_PTR(0) (in other words NULL). The callers are not expecting that and would Oops. Fixes: 375637bc5249 ("perf/core: Introduce address range filtering") Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> --- v2: split up the patch diff --git a/kernel/events/core.c b/kernel/events/core.c index 13f5b942580b..4c24bc4c8a63 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -9476,8 +9474,10 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, event->addr_filters_offs = kcalloc(pmu->nr_addr_filters, sizeof(unsigned long), GFP_KERNEL); - if (!event->addr_filters_offs) + if (!event->addr_filters_offs) { + err = -ENOMEM; goto err_per_task; + } /* force hw sync on the address filters */ event->addr_filters_gen = 1; -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html