|
@@ -14,6 +14,7 @@
|
|
|
#include <linux/slab.h>
|
|
|
#include <linux/circ_buf.h>
|
|
|
#include <linux/poll.h>
|
|
|
+#include <linux/nospec.h>
|
|
|
|
|
|
#include "internal.h"
|
|
|
|
|
@@ -867,8 +868,10 @@ perf_mmap_to_page(struct ring_buffer *rb, unsigned long pgoff)
|
|
|
return NULL;
|
|
|
|
|
|
/* AUX space */
|
|
|
- if (pgoff >= rb->aux_pgoff)
|
|
|
- return virt_to_page(rb->aux_pages[pgoff - rb->aux_pgoff]);
|
|
|
+ if (pgoff >= rb->aux_pgoff) {
|
|
|
+ int aux_pgoff = array_index_nospec(pgoff - rb->aux_pgoff, rb->aux_nr_pages);
|
|
|
+ return virt_to_page(rb->aux_pages[aux_pgoff]);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return __perf_mmap_to_page(rb, pgoff);
|