[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1478075943.7065.361.camel@edumazet-glaptop3.roam.corp.google.com>
Date: Wed, 02 Nov 2016 01:39:03 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Subash Abhinov Kasiviswanathan <subashab@...eaurora.org>
Cc: netdev@...r.kernel.org, Eric Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH net] net: Check for fullsock in sock_i_uid()
On Tue, 2016-11-01 at 23:27 -0600, Subash Abhinov Kasiviswanathan wrote:
> 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@...eaurora.org>
> Cc: Eric Dumazet <edumazet@...gle.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;
This would be a bug in the caller.
Can you give us the complete stack trace leading to the problem you
had ?
Thanks !
Powered by blists - more mailing lists