Unverified Commit a48a7522 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!8157 [sync] PR-8017: perf/core: Bail out early if the request AUX area is out of bound

parents f179f3c5 2364e3d4
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -691,6 +691,12 @@ int rb_alloc_aux(struct perf_buffer *rb, struct perf_event *event,
		max_order--;
	}

	/*
	 * kcalloc_node() is unable to allocate buffer if the size is larger
	 * than: PAGE_SIZE << MAX_ORDER; directly bail out in this case.
	 */
	if (get_order((unsigned long)nr_pages * sizeof(void *)) > MAX_ORDER)
		return -ENOMEM;
	rb->aux_pages = kcalloc_node(nr_pages, sizeof(void *), GFP_KERNEL,
				     node);
	if (!rb->aux_pages)