diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2018-01-16 18:51:45 -0500 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-01-16 19:15:05 -0500 |
commit | 0a2d28ff516c48a21c1e3be1ff7fba3e94248baa (patch) | |
tree | 65ee7b65a852fcc14ed31d3b11bf88abc17ef296 | |
parent | 4c38f74c9186e2bc32789ddab3a95ed384c695d7 (diff) |
bpf: offload: make bpf_offload_dev_match() reject host+host case
Daniel suggests it would be more logical for bpf_offload_dev_match()
to return false is either the program or the map are not offloaded,
rather than treating the both not offloaded case as a "matching
CPU/host device".
This makes no functional difference today, since verifier only calls
bpf_offload_dev_match() when one of the objects is offloaded.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rw-r--r-- | kernel/bpf/offload.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/kernel/bpf/offload.c b/kernel/bpf/offload.c index 453785fa1881..a88cebf368bf 100644 --- a/kernel/bpf/offload.c +++ b/kernel/bpf/offload.c | |||
@@ -395,10 +395,8 @@ bool bpf_offload_dev_match(struct bpf_prog *prog, struct bpf_map *map) | |||
395 | struct bpf_prog_offload *offload; | 395 | struct bpf_prog_offload *offload; |
396 | bool ret; | 396 | bool ret; |
397 | 397 | ||
398 | if (!!bpf_prog_is_dev_bound(prog->aux) != !!bpf_map_is_dev_bound(map)) | 398 | if (!bpf_prog_is_dev_bound(prog->aux) || !bpf_map_is_dev_bound(map)) |
399 | return false; | 399 | return false; |
400 | if (!bpf_prog_is_dev_bound(prog->aux)) | ||
401 | return true; | ||
402 | 400 | ||
403 | down_read(&bpf_devs_lock); | 401 | down_read(&bpf_devs_lock); |
404 | offload = prog->aux->offload; | 402 | offload = prog->aux->offload; |