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 <subas...@codeaurora.org>
Cc: Eric Dumazet <eduma...@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

Reply via email to