On Tue, 2016-01-05 at 10:57 -0500, Craig Gallek wrote:
> From: Craig Gallek <[email protected]>
>
> Fixes: 538950a1b752 ("soreuseport: setsockopt SO_ATTACH_REUSEPORT_[CE]BPF")
> Suggested-by: Daniel Borkmann <[email protected]>
> Signed-off-by: Craig Gallek <[email protected]>
> ---
> net/core/sock_reuseport.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/sock_reuseport.c b/net/core/sock_reuseport.c
> index ae0969c0fc2e..1df98c557440 100644
> --- a/net/core/sock_reuseport.c
> +++ b/net/core/sock_reuseport.c
> @@ -173,7 +173,7 @@ static struct sock *run_bpf(struct sock_reuseport *reuse,
> u16 socks,
>
> /* temporarily advance data past protocol header */
> if (!pskb_pull(skb, hdr_len)) {
> - consume_skb(nskb);
> + kfree_skb(nskb);
> return NULL;
> }
> index = bpf_prog_run_save_cb(prog, skb);
Note that we always call reuseport_select_sock() after pulling the
headers in skb->head anyway, so the pskb_pull() can never fail.
It really could be __skb_pull()
BTW, why UDP calls reuseport_select_sock() with hdr_len == 0 sometimes ?
I believe the following patch is needed.
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 835378365f25..52387096dbba 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -514,7 +514,8 @@ begin:
struct sock *sk2;
hash = udp_ehashfn(net, daddr, hnum,
saddr, sport);
- sk2 = reuseport_select_sock(sk, hash, NULL, 0);
+ sk2 = reuseport_select_sock(sk, hash, NULL,
+ sizeof(struct
udphdr));
if (sk2) {
result = sk2;
goto found;
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 56fcb55fda31..da0a5fa02b0f 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -272,7 +272,8 @@ begin:
struct sock *sk2;
hash = udp6_ehashfn(net, daddr, hnum,
saddr, sport);
- sk2 = reuseport_select_sock(sk, hash, NULL, 0);
+ sk2 = reuseport_select_sock(sk, hash, NULL,
+ sizeof(struct
udphdr));
if (sk2) {
result = sk2;
goto found;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html