Re: net/nfc: GPF in llcp_sock_getname
From: Cong Wang
Date: Fri Jan 01 2016 - 18:50:00 EST
On Fri, Jan 1, 2016 at 5:58 AM, Dmitry Vyukov <dvyukov@xxxxxxxxxx> wrote:
> GPF seems to be caused by a data race on socket state.
Seems you are right, I think the following patch should work:
diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c
index ecf0a01..5a91997 100644
--- a/net/nfc/llcp_sock.c
+++ b/net/nfc/llcp_sock.c
@@ -500,7 +500,7 @@ static int llcp_sock_getname(struct socket *sock,
struct sockaddr *uaddr,
struct nfc_llcp_sock *llcp_sock = nfc_llcp_sock(sk);
DECLARE_SOCKADDR(struct sockaddr_nfc_llcp *, llcp_addr, uaddr);
- if (llcp_sock == NULL || llcp_sock->dev == NULL)
+ if (llcp_sock == NULL || sk->sk_state == LLCP_CLOSED)
return -EBADFD;
pr_debug("%p %d %d %d\n", sk, llcp_sock->target_idx,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/