diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index ea6c8c0663ebd3..68dfdfcff2b236 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -1834,28 +1834,16 @@ static int check_stack_boundary(struct bpf_verifier_env *env, int regno, if (meta && meta->raw_mode) meta = NULL; - if (reg->smax_value >= BPF_MAX_VAR_OFF || - reg->smax_value <= -BPF_MAX_VAR_OFF) { - verbose(env, "R%d unbounded indirect variable offset stack access\n", - regno); - return -EACCES; - } min_off = reg->smin_value + reg->off; - max_off = reg->smax_value + reg->off; + max_off = reg->umax_value + reg->off; err = __check_stack_boundary(env, regno, min_off, access_size, zero_size_allowed); - if (err) { - verbose(env, "R%d min value is outside of stack bound\n", - regno); + if (err) return err; - } err = __check_stack_boundary(env, regno, max_off, access_size, zero_size_allowed); - if (err) { - verbose(env, "R%d max value is outside of stack bound\n", - regno); + if (err) return err; - } } if (meta && meta->raw_mode) {