Skip to content

Commit

Permalink
NFC: Fix possible NULL ptr deref when getting the name of a socket
Browse files Browse the repository at this point in the history
llcp_sock_getname() might get called before the LLCP socket was created.
This condition isn't checked, and llcp_sock_getname will simply deref a
NULL ptr in that case.

This exists starting with d646960 ("NFC: Initial LLCP support").

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
sashalevin authored and linvjw committed Jun 8, 2012
1 parent d012d04 commit 58d1eab
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/nfc/llcp/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@ static int llcp_sock_getname(struct socket *sock, struct sockaddr *addr,

pr_debug("%p\n", sk);

if (llcp_sock == NULL)
return -EBADFD;

addr->sa_family = AF_NFC;
*len = sizeof(struct sockaddr_nfc_llcp);

Expand Down

0 comments on commit 58d1eab

Please sign in to comment.