Skip to content

Commit 01e71c2

Browse files
olsajirigregkh
authored andcommitted
perf: Return proper values for user stack errors
commit 78b562f upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 6603808 commit 01e71c2

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
@@ -9750,9 +9750,9 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr,
97509750
* __u16 sample size limit.
97519751
*/
97529752
if (attr->sample_stack_user >= USHRT_MAX)
9753-
ret = -EINVAL;
9753+
return -EINVAL;
97549754
else if (!IS_ALIGNED(attr->sample_stack_user, sizeof(u64)))
9755-
ret = -EINVAL;
9755+
return -EINVAL;
97569756
}
97579757

97589758
if (attr->sample_type & PERF_SAMPLE_REGS_INTR)

0 commit comments

Comments
 (0)