Re: netlink: Kill bogus lock_sock in netlink_insert
From: David Miller <hidden>
Date: 2015-05-15 17:02:27
From: David Miller <hidden>
Date: 2015-05-15 17:02:27
From: Herbert Xu <herbert@gondor.apana.org.au> Date: Thu, 14 May 2015 14:02:30 +0800
The commit c5adde9468b0714a051eac7f9666f23eb10b61f7 ("netlink:
eliminate nl_sk_hash_lock") added a lock_sock to netlink_insert
with no justifications whatsoever.
This patch kills it.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>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.