sched, bpf: let stack handle !IFF_UP devs on bpf_clone_redirect
authorDaniel Borkmann <daniel@iogearbox.net>
Wed, 23 Sep 2015 20:20:15 +0000 (22:20 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 Sep 2015 21:25:51 +0000 (14:25 -0700)
Similarly as already the case in bpf_redirect()/skb_do_redirect()
pair, let the stack deal with devs that are !IFF_UP.

dev_forward_skb() as well as dev_queue_xmit() will free the skb
and increment drop counter internally in such cases, so we can
spare the condition in bpf_clone_redirect().

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/filter.c

index da3f3d94d6e93c7411a1f8369be9c180124fffc9..96bd962c292df9f63720a009a85561d6a9a848b3 100644 (file)
@@ -1404,9 +1404,6 @@ static u64 bpf_clone_redirect(u64 r1, u64 ifindex, u64 flags, u64 r4, u64 r5)
        if (unlikely(!dev))
                return -EINVAL;
 
-       if (unlikely(!(dev->flags & IFF_UP)))
-               return -EINVAL;
-
        skb2 = skb_clone(skb, GFP_ATOMIC);
        if (unlikely(!skb2))
                return -ENOMEM;