Commit fe3c094abc2365a226184554501fe0df87fe8271

Authored by Samuel Ortiz
Committed by John W. Linville
1 parent 01d719a228

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>

Showing 1 changed file with 3 additions and 0 deletions Side-by-side Diff

... ... @@ -294,6 +294,9 @@
294 294 struct nfc_llcp_sock *llcp_sock = nfc_llcp_sock(sk);
295 295 DECLARE_SOCKADDR(struct sockaddr_nfc_llcp *, llcp_addr, uaddr);
296 296  
  297 + if (llcp_sock == NULL || llcp_sock->dev == NULL)
  298 + return -EBADFD;
  299 +
297 300 pr_debug("%p %d %d %d\n", sk, llcp_sock->target_idx,
298 301 llcp_sock->dsap, llcp_sock->ssap);
299 302