From: Samuel Ortiz Date: Fri, 29 Jun 2012 10:03:55 +0000 (+0200) Subject: NFC: Dereference LLCP bind socket address after checking for it to be NULL X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=c66433dc5dda15861dcbac63a97645771d14feb6;p=linux-beck.git NFC: Dereference LLCP bind socket address after checking for it to be NULL Reported-by: Dan Carpenter Signed-off-by: Samuel Ortiz --- diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c index e5d80142b825..6152d05f8378 100644 --- a/net/nfc/llcp/sock.c +++ b/net/nfc/llcp/sock.c @@ -78,11 +78,11 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) struct sockaddr_nfc_llcp llcp_addr; int len, ret = 0; - pr_debug("sk %p addr %p family %d\n", sk, addr, addr->sa_family); - if (!addr || addr->sa_family != AF_NFC) return -EINVAL; + pr_debug("sk %p addr %p family %d\n", sk, addr, addr->sa_family); + memset(&llcp_addr, 0, sizeof(llcp_addr)); len = min_t(unsigned int, sizeof(llcp_addr), alen); memcpy(&llcp_addr, addr, len);