* [PATCH bpf-next] bpf: Verify flags in bpf_fib_lookup
@ 2018-05-29 18:59 dsahern
2018-05-29 19:51 ` Daniel Borkmann
0 siblings, 1 reply; 2+ messages in thread
From: dsahern @ 2018-05-29 18:59 UTC (permalink / raw)
To: netdev, borkmann, ast; +Cc: David Ahern
From: David Ahern <dsahern@gmail.com>
Verify flags argument contains only known flags. Allows programs to probe
for support as more are added.
Signed-off-by: David Ahern <dsahern@gmail.com>
---
net/core/filter.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/core/filter.c b/net/core/filter.c
index 24e6ce8be567..4cff6d9cd724 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -4270,6 +4270,9 @@ BPF_CALL_4(bpf_xdp_fib_lookup, struct xdp_buff *, ctx,
if (plen < sizeof(*params))
return -EINVAL;
+ if (flags & ~(BPF_FIB_LOOKUP_DIRECT | BPF_FIB_LOOKUP_OUTPUT))
+ return -EINVAL;
+
switch (params->family) {
#if IS_ENABLED(CONFIG_INET)
case AF_INET:
@@ -4304,6 +4307,9 @@ BPF_CALL_4(bpf_skb_fib_lookup, struct sk_buff *, skb,
if (plen < sizeof(*params))
return -EINVAL;
+ if (flags & ~(BPF_FIB_LOOKUP_DIRECT | BPF_FIB_LOOKUP_OUTPUT))
+ return -EINVAL;
+
switch (params->family) {
#if IS_ENABLED(CONFIG_INET)
case AF_INET:
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH bpf-next] bpf: Verify flags in bpf_fib_lookup
2018-05-29 18:59 [PATCH bpf-next] bpf: Verify flags in bpf_fib_lookup dsahern
@ 2018-05-29 19:51 ` Daniel Borkmann
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Borkmann @ 2018-05-29 19:51 UTC (permalink / raw)
To: dsahern, netdev, borkmann, ast; +Cc: David Ahern
On 05/29/2018 08:59 PM, dsahern@kernel.org wrote:
> From: David Ahern <dsahern@gmail.com>
>
> Verify flags argument contains only known flags. Allows programs to probe
> for support as more are added.
>
> Signed-off-by: David Ahern <dsahern@gmail.com>
Applied to bpf-next, thanks David!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-29 19:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-29 18:59 [PATCH bpf-next] bpf: Verify flags in bpf_fib_lookup dsahern
2018-05-29 19:51 ` Daniel Borkmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).