Skip to content

Commit 78b562f

Browse files
olsajiriacmel
authored andcommitted
perf: Return proper values for user stack errors
Return immediately when we find issue in the user stack checks. The error value could get overwritten by following check for PERF_SAMPLE_REGS_INTR. Signed-off-by: Jiri Olsa <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Fixes: 60e2364 ("perf: Add ability to sample machine state on interrupt") Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 038586c commit 78b562f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/events/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10209,9 +10209,9 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr,
1020910209
* __u16 sample size limit.
1021010210
*/
1021110211
if (attr->sample_stack_user >= USHRT_MAX)
10212-
ret = -EINVAL;
10212+
return -EINVAL;
1021310213
else if (!IS_ALIGNED(attr->sample_stack_user, sizeof(u64)))
10214-
ret = -EINVAL;
10214+
return -EINVAL;
1021510215
}
1021610216

1021710217
if (!attr->sample_max_stack)

0 commit comments

Comments
 (0)