Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1300015

Re: net/nfc: GPF in llcp_sock_getname

From Cong Wang <xiyou.wangcong@gmail.com>
Newsgroups linux.kernel
Subject Re: net/nfc: GPF in llcp_sock_getname
Date 2016-01-02 01:00 +0100
Message-ID <qMhLX-B4-3@gated-at.bofh.it> (permalink)
References <qM8pj-39E-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Jan 1, 2016 at 5:58 AM, Dmitry Vyukov <dvyukov@google.com> 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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

net/nfc: GPF in llcp_sock_getname Dmitry Vyukov <dvyukov@google.com> - 2016-01-01 15:00 +0100
  Re: net/nfc: GPF in llcp_sock_getname Cong Wang <xiyou.wangcong@gmail.com> - 2016-01-01 22:00 +0100
    Re: net/nfc: GPF in llcp_sock_getname Cong Wang <xiyou.wangcong@gmail.com> - 2016-01-02 00:30 +0100
  Re: net/nfc: GPF in llcp_sock_getname Cong Wang <xiyou.wangcong@gmail.com> - 2016-01-02 01:00 +0100

csiph-web