diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2012-05-04 11:24:16 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-06-04 21:34:28 +0200 |
commit | c7aa12252f5142b9eee2f6e34ca8870a8e7e048c (patch) | |
tree | e91c72609e7d13b3a185cf75acd74a8385c736c5 /net/nfc/llcp/sock.c | |
parent | f8f5701bdaf9134b1f90e5044a82c66324d2073f (diff) | |
download | op-kernel-dev-c7aa12252f5142b9eee2f6e34ca8870a8e7e048c.zip op-kernel-dev-c7aa12252f5142b9eee2f6e34ca8870a8e7e048c.tar.gz |
NFC: Take a reference on the LLCP local pointer when creating a socket
LLCP sockets point to their local LLCP service, so they need to take a
reference on it.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/llcp/sock.c')
-rw-r--r-- | net/nfc/llcp/sock.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c index 3f339b1..9ac397b 100644 --- a/net/nfc/llcp/sock.c +++ b/net/nfc/llcp/sock.c @@ -111,7 +111,7 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) } llcp_sock->dev = dev; - llcp_sock->local = local; + llcp_sock->local = nfc_llcp_local_get(local); llcp_sock->nfc_protocol = llcp_addr.nfc_protocol; llcp_sock->service_name_len = min_t(unsigned int, llcp_addr.service_name_len, @@ -487,7 +487,7 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr, } llcp_sock->dev = dev; - llcp_sock->local = local; + llcp_sock->local = nfc_llcp_local_get(local); llcp_sock->ssap = nfc_llcp_get_local_ssap(local); if (llcp_sock->ssap == LLCP_SAP_MAX) { ret = -ENOMEM; @@ -701,8 +701,6 @@ struct sock *nfc_llcp_sock_alloc(struct socket *sock, int type, gfp_t gfp) void nfc_llcp_sock_free(struct nfc_llcp_sock *sock) { - struct nfc_llcp_local *local = sock->local; - kfree(sock->service_name); skb_queue_purge(&sock->tx_queue); @@ -710,13 +708,11 @@ void nfc_llcp_sock_free(struct nfc_llcp_sock *sock) skb_queue_purge(&sock->tx_backlog_queue); list_del_init(&sock->accept_queue); - - if (local != NULL && sock == local->sockets[sock->ssap]) - local->sockets[sock->ssap] = NULL; - else - list_del_init(&sock->list); + list_del_init(&sock->list); sock->parent = NULL; + + nfc_llcp_local_put(sock->local); } static int llcp_sock_create(struct net *net, struct socket *sock, |