[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALnjE+oA6Cp3whfdWVkkRd-jYsYdbKM9u_bwPwKq2tRdtnJdQQ@mail.gmail.com>
Date: Wed, 31 Jul 2013 20:00:12 -0700
From: Pravin Shelar <pshelar@...ira.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net-next v5 1/7] vxlan: Restructure vxlan socket apis.
On Wed, Jul 31, 2013 at 4:45 PM, Stephen Hemminger
<stephen@...workplumber.org> wrote:
> 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.
I do not think it is possible.
Create new socket does bind which shld fail on same port. So there
would be only one vxlan-sock entry in socket table.
--
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