]> git.proxmox.com Git - mirror_iproute2.git/commit - lib/bpf.c
bpf: test for valid type in bpf_get_work_dir
authorDaniel Borkmann <daniel@iogearbox.net>
Mon, 6 Mar 2017 12:06:00 +0000 (13:06 +0100)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 9 Mar 2017 01:57:00 +0000 (17:57 -0800)
commit51361a9f1cfca81259c68515cb24fbaace03136a
treee41e34782c3c4ca8516152416f99480436263673
parent54eab4c79a6086f4d1e15ce228163514d2d2415b
bpf: test for valid type in bpf_get_work_dir

Jan-Erik reported an assertion in bpf_prog_to_subdir() failed where
type was BPF_PROG_TYPE_UNSPEC, which is only used in bpf_init_env()
to auto-mount and cache the bpf fs mount point.

Therefore, make sure when bpf_init_env() is called multiple times
(f.e. eBPF classifier with eBPF action attached) and bpf_mnt_cached
is set already that the type is also valid. In bpf_init_env(), we're
only interested in the mount point and not a type-specific subdir.

Fixes: e42256699cac ("bpf: make tc's bpf loader generic and move into lib")
Reported-by: Jan-Erik Rediger <janerik@rediger.net>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
lib/bpf.c