Skip to content

Commit

Permalink
bpf: fix JSLT validation
Browse files Browse the repository at this point in the history
[ upstream commit cdcee2e ]

In function 'eval_jcc', judgment 'op == EBPF_JLT' occurs
twice, as a result, the corresponding second statement
cannot be accessed.

This patch fix this problem.

Fixes: 8021917 ("bpf: add extra validation for input BPF program")

Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
  • Loading branch information
Hongbo Zheng authored and steevenlee committed Jun 8, 2021
1 parent a5fd209 commit 2c6016c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/librte_bpf/bpf_validate.c
Expand Up @@ -1115,7 +1115,7 @@ eval_jcc(struct bpf_verifier *bvf, const struct ebpf_insn *ins)
eval_jsgt_jsle(trd, trs, frd, frs);
else if (op == EBPF_JSLE)
eval_jsgt_jsle(frd, frs, trd, trs);
else if (op == EBPF_JLT)
else if (op == EBPF_JSLT)
eval_jslt_jsge(trd, trs, frd, frs);
else if (op == EBPF_JSGE)
eval_jslt_jsge(frd, frs, trd, trs);
Expand Down

0 comments on commit 2c6016c

Please sign in to comment.