netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: Check for fullsock in sock_i_uid()
@ 2016-11-02  5:27 Subash Abhinov Kasiviswanathan
  2016-11-02  8:39 ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Subash Abhinov Kasiviswanathan @ 2016-11-02  5:27 UTC (permalink / raw)
  To: netdev; +Cc: Subash Abhinov Kasiviswanathan, Eric Dumazet

sock_i_uid() acquires the sk_callback_lock which does not exist
for sockets in TCP_NEW_SYN_RECV state. This results in errors
showing up as spinlock bad magic.

Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Cc: Eric Dumazet <edumazet@google.com>
---
 net/core/sock.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/core/sock.c b/net/core/sock.c
index c73e28f..af15ef0 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1727,7 +1727,10 @@ void sock_efree(struct sk_buff *skb)
 
 kuid_t sock_i_uid(struct sock *sk)
 {
-	kuid_t uid;
+	kuid_t uid = GLOBAL_ROOT_UID;
+
+	if (!sk_fullsock(sk))
+		return uid;
 
 	read_lock_bh(&sk->sk_callback_lock);
 	uid = sk->sk_socket ? SOCK_INODE(sk->sk_socket)->i_uid : GLOBAL_ROOT_UID;
-- 
1.9.1

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

end of thread, other threads:[~2016-11-03 17:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-02  5:27 [PATCH net] net: Check for fullsock in sock_i_uid() Subash Abhinov Kasiviswanathan
2016-11-02  8:39 ` Eric Dumazet
2016-11-02 17:05   ` subashab
2016-11-02 17:18     ` Eric Dumazet
2016-11-03 17:34       ` Lorenzo Colitti

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).