[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150516123242.GA683@gondor.apana.org.au>
Date: Sat, 16 May 2015 20:32:42 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: David Miller <davem@...hat.com>
Cc: eric.dumazet@...il.com, tgraf@...g.ch, netdev@...r.kernel.org,
ying.xue@...driver.com
Subject: Re: netlink: Kill bogus lock_sock in netlink_insert
On Fri, May 15, 2015 at 01:02:19PM -0400, David Miller wrote:
>
> Actually, Herbert, I think this lock_sock() is needed.
>
> Otherwise nothing protects nlk_sk(sk)->portid, upon which we
> perform a non-atomic test-and-set operation here.
>
> If you remove the lock_sock(), two parallel bind/inserts are
> possible on the same socket, potentially resulting in socket
> state corruption.
You're quite right. I forgot about that case.
However, the code as is still buggy because it fails to reset
portid when our auto-allocated portid collides with somebody
else, resulting in a bogus bind failure.
I'll fix that up too in a new patch.
Cheers,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
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