diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 98ed27bbd045..d27d5a880015 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -6982,12 +6982,13 @@ skip_full_check: while (!pop_stack(env, NULL, NULL)); free_states(env); - if (ret == 0) - sanitize_dead_code(env); - if (ret == 0) ret = check_max_stack_depth(env); + /* instruction rewrites happen after this point */ + if (ret == 0) + sanitize_dead_code(env); + if (ret == 0) /* program is valid, convert *(u32*)(ctx + off) accesses */ ret = convert_ctx_accesses(env);