On Tue, Jan 5, 2016 at 5:33 PM, Eric Dumazet <eric.duma...@gmail.com> wrote:
> From: Eric Dumazet <eduma...@google.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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to