diff --git a/kernel/events/core.c b/kernel/events/core.c
index 744e8726c5b2fa226ef4514f04d480fc9015d52a..0c000cb01eeb159bb60b06a9ccf7e539dcdf0344 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -10193,7 +10193,7 @@ static void perf_event_addr_filters_apply(struct perf_event *event)
 		return;
 
 	if (ifh->nr_file_filters) {
-		mm = get_task_mm(event->ctx->task);
+		mm = get_task_mm(task);
 		if (!mm)
 			goto restart;