diff options
-rw-r--r-- | arch/x86/events/core.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index d31735f37ed7..9d4bf3ab049e 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c | |||
@@ -2352,7 +2352,7 @@ perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry_ctx *ent | |||
2352 | frame.next_frame = 0; | 2352 | frame.next_frame = 0; |
2353 | frame.return_address = 0; | 2353 | frame.return_address = 0; |
2354 | 2354 | ||
2355 | if (!access_ok(VERIFY_READ, fp, 8)) | 2355 | if (!valid_user_frame(fp, sizeof(frame))) |
2356 | break; | 2356 | break; |
2357 | 2357 | ||
2358 | bytes = __copy_from_user_nmi(&frame.next_frame, fp, 4); | 2358 | bytes = __copy_from_user_nmi(&frame.next_frame, fp, 4); |
@@ -2362,9 +2362,6 @@ perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry_ctx *ent | |||
2362 | if (bytes != 0) | 2362 | if (bytes != 0) |
2363 | break; | 2363 | break; |
2364 | 2364 | ||
2365 | if (!valid_user_frame(fp, sizeof(frame))) | ||
2366 | break; | ||
2367 | |||
2368 | perf_callchain_store(entry, cs_base + frame.return_address); | 2365 | perf_callchain_store(entry, cs_base + frame.return_address); |
2369 | fp = compat_ptr(ss_base + frame.next_frame); | 2366 | fp = compat_ptr(ss_base + frame.next_frame); |
2370 | } | 2367 | } |
@@ -2413,7 +2410,7 @@ perf_callchain_user(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs | |||
2413 | frame.next_frame = NULL; | 2410 | frame.next_frame = NULL; |
2414 | frame.return_address = 0; | 2411 | frame.return_address = 0; |
2415 | 2412 | ||
2416 | if (!access_ok(VERIFY_READ, fp, sizeof(*fp) * 2)) | 2413 | if (!valid_user_frame(fp, sizeof(frame))) |
2417 | break; | 2414 | break; |
2418 | 2415 | ||
2419 | bytes = __copy_from_user_nmi(&frame.next_frame, fp, sizeof(*fp)); | 2416 | bytes = __copy_from_user_nmi(&frame.next_frame, fp, sizeof(*fp)); |
@@ -2423,9 +2420,6 @@ perf_callchain_user(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs | |||
2423 | if (bytes != 0) | 2420 | if (bytes != 0) |
2424 | break; | 2421 | break; |
2425 | 2422 | ||
2426 | if (!valid_user_frame(fp, sizeof(frame))) | ||
2427 | break; | ||
2428 | |||
2429 | perf_callchain_store(entry, frame.return_address); | 2423 | perf_callchain_store(entry, frame.return_address); |
2430 | fp = (void __user *)frame.next_frame; | 2424 | fp = (void __user *)frame.next_frame; |
2431 | } | 2425 | } |