All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2 master] bpf: test for valid type in bpf_get_work_dir
@ 2017-03-06 12:06 Daniel Borkmann
  2017-03-09  1:57 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Borkmann @ 2017-03-06 12:06 UTC (permalink / raw)
  To: stephen; +Cc: alexei.starovoitov, janerik, netdev, Daniel Borkmann

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bpf.c b/lib/bpf.c
index 211c3d1..04ee1ab 100644
--- a/lib/bpf.c
+++ b/lib/bpf.c
@@ -596,7 +596,7 @@ static const char *bpf_get_work_dir(enum bpf_prog_type type)
 	if (bpf_mnt_cached) {
 		const char *out = mnt;
 
-		if (out) {
+		if (out && type) {
 			snprintf(bpf_tmp, sizeof(bpf_tmp), "%s%s/",
 				 out, bpf_prog_to_subdir(type));
 			out = bpf_tmp;
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH iproute2 master] bpf: test for valid type in bpf_get_work_dir
  2017-03-06 12:06 [PATCH iproute2 master] bpf: test for valid type in bpf_get_work_dir Daniel Borkmann
@ 2017-03-09  1:57 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2017-03-09  1:57 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: alexei.starovoitov, janerik, netdev

On Mon,  6 Mar 2017 13:06:00 +0100
Daniel Borkmann <daniel@iogearbox.net> wrote:

> 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>

Applied

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-09  2:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-06 12:06 [PATCH iproute2 master] bpf: test for valid type in bpf_get_work_dir Daniel Borkmann
2017-03-09  1:57 ` Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.