[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEfhGiwB6=oPm7uMMazkCZ5G+tijkq1PLCSgm1G4ES-7Hodp6Q@mail.gmail.com>
Date: Tue, 5 Jan 2016 17:56:06 -0500
From: Craig Gallek <kraigatgoog@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH v2 net-next] udp_diag: fix udp_dump_one() vs SO_REUSEPORT
On Tue, Jan 5, 2016 at 5:33 PM, Eric Dumazet <eric.dumazet@...il.com> wrote:
> From: Eric Dumazet <edumazet@...gle.com>
> + unsigned short hnum = ntohs(req->id.idiag_dport);
> + unsigned int slot = udp_hashfn(net, hnum, tbl->mask);
> + struct udp_hslot *hslot = &tbl->hash[slot];
> + struct hlist_nulls_node *node;
> + int err = -ENOENT;
> +
> + spin_lock_bh(&hslot->lock);
> + sk_nulls_for_each(aux, node, &hslot->head) {
> + if (net_eq(sock_net(aux), net) &&
> + !sock_diag_check_cookie(aux, req->id.idiag_cookie) &&
> + (req->sdiag_family == AF_UNSPEC ||
> + req->sdiag_family == aux->sk_family)) {
> + sk = aux;
> + sock_hold(sk);
> + break;
> + }
> + }
> + spin_unlock_bh(&hslot->lock);
> if (!sk)
> goto out_nosk;
>
> - err = sock_diag_check_cookie(sk, req->id.idiag_cookie);
> - if (err)
> - goto out;
> -
sock_diag_check_cookie will return successfully if the cookie in the
request is INET_DIAG_NOCOOKIE before even considering the socket. I
think this could cause this loop to prematurely terminate.
Also, previously this would return ESTALE on a cookie error, now it
returns ENOENT. Not sure if this is a big deal or not, though...
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists