diff --git a/kernel/bpf/fixups.c b/kernel/bpf/fixups.c index b2fa7e8bedf3..608621d7f225 100644 --- a/kernel/bpf/fixups.c +++ b/kernel/bpf/fixups.c @@ -477,11 +477,7 @@ static int adjust_subprog_starts_after_remove(struct bpf_verifier_env *env, if (j > i) { struct bpf_prog_aux *aux = env->prog->aux; - int move, k; - - /* The removed subprogs own their jump tables. */ - for (k = i; k < j; k++) - kvfree(env->subprog_info[k].jt); + int move; /* move fake 'exit' subprog as well */ move = env->subprog_cnt + 1 - j; @@ -489,9 +485,6 @@ static int adjust_subprog_starts_after_remove(struct bpf_verifier_env *env, memmove(env->subprog_info + i, env->subprog_info + j, sizeof(*env->subprog_info) * move); - /* The vacated tail still holds copies of the moved entries. */ - memset(env->subprog_info + i + move, 0, - sizeof(*env->subprog_info) * (j - i)); env->subprog_cnt -= j - i; /* remove func_info and its aux */ diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index ec136cf377c1..62f8951126ba 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -23487,6 +23487,8 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr, bpfptr_t uattr, if (ret < 0) goto skip_full_check; + bpf_free_subprog_jts(env); + ret = mark_fastcall_patterns(env); if (ret < 0) goto skip_full_check;