[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130731164521.09c43fb8@nehalam.linuxnetplumber.net>
Date: Wed, 31 Jul 2013 16:45:21 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Pravin B Shelar <pshelar@...ira.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net-next v5 1/7] vxlan: Restructure vxlan socket apis.
On Wed, 31 Jul 2013 16:14:23 -0700
Pravin B Shelar <pshelar@...ira.com> wrote:
> /* Disable multicast loopback */
> inet_sk(sk)->mc_loop = 0;
> + spin_lock(&vn->sock_lock);
> + hlist_add_head_rcu(&vs->hlist, vs_head(net, port));
> + spin_unlock(&vn->sock_lock);
>
This change could potentially put two of the sockets with the
same port in the list.
There is an existing check in vxlan_sock_work to handle this
now. It does:
create new socket (no locks)
spin_lock
if (udp_socket with that port exists)
drop new socket
else
add to list
spin_unlock
Your code seems to immediately put it on the list which
will cause duplicates if race occurs.
--
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