summaryrefslogtreecommitdiff
path: root/net/nfc/llcp/sock.c
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2012-07-05 15:43:08 (GMT)
committerJohn W. Linville <linville@tuxdriver.com>2012-07-09 20:42:25 (GMT)
commitfe3c094abc2365a226184554501fe0df87fe8271 (patch)
tree3ea791d11ba5b992f53ea492967becfab7024686 /net/nfc/llcp/sock.c
parent01d719a2287ec34f631800d10f1fad3c134c3e89 (diff)
downloadlinux-fsl-qoriq-fe3c094abc2365a226184554501fe0df87fe8271.tar.xz
NFC: Check for llcp_sock and its device from llcp_sock_getname
They both can potentially be NULL. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/llcp/sock.c')
-rw-r--r--net/nfc/llcp/sock.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c
index 6152d05..ddeb9aa 100644
--- a/net/nfc/llcp/sock.c
+++ b/net/nfc/llcp/sock.c
@@ -294,6 +294,9 @@ 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)
+ return -EBADFD;
+
pr_debug("%p %d %d %d\n", sk, llcp_sock->target_idx,
llcp_sock->dsap, llcp_sock->ssap);