netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] netlink: fix boolean evaluation on bound
@ 2015-12-14 16:55 Hannes Frederic Sowa
  2015-12-14 17:06 ` Herbert Xu
  0 siblings, 1 reply; 5+ messages in thread
From: Hannes Frederic Sowa @ 2015-12-14 16:55 UTC (permalink / raw)
  To: netdev; +Cc: Herbert Xu

portid may be 0, thus bound will set the flag to false for in-kernel
created netlink sockets.

Fixes: da314c9923fed55 ("netlink: Replace rhash_portid with bound")
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
---
This patch should not affect anything and is just meant to close this
loophole in future. I based it on net, but you can also apply it to
net-next.

 net/netlink/af_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 59651af8cc2705..278e94c3c7f6d1 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1137,7 +1137,7 @@ static int netlink_insert(struct sock *sk, u32 portid)
 
 	/* We need to ensure that the socket is hashed and visible. */
 	smp_wmb();
-	nlk_sk(sk)->bound = portid;
+	nlk_sk(sk)->bound = true;
 
 err:
 	release_sock(sk);
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-12-14 21:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-14 16:55 [PATCH net] netlink: fix boolean evaluation on bound Hannes Frederic Sowa
2015-12-14 17:06 ` Herbert Xu
2015-12-14 17:27   ` Hannes Frederic Sowa
2015-12-14 17:50     ` Eric Dumazet
2015-12-14 21:07       ` Hannes Frederic Sowa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).