linux/net/nfc
Mateusz Jurczyk 608c4adfca nfc: Fix the sockaddr length sanitization in llcp_sock_connect
Fix the sockaddr length verification in the connect() handler of NFC/LLCP
sockets, to compare against the size of the actual structure expected on
input (sockaddr_nfc_llcp) instead of its shorter version (sockaddr_nfc).

Both structures are defined in include/uapi/linux/nfc.h. The fields
specific to the _llcp extended struct are as follows:

   276		__u8 dsap; /* Destination SAP, if known */
   277		__u8 ssap; /* Source SAP to be bound to */
   278		char service_name[NFC_LLCP_MAX_SERVICE_NAME]; /* Service name URI */;
   279		size_t service_name_len;

If the caller doesn't provide a sufficiently long sockaddr buffer, these
fields remain uninitialized (and they currently originate from the stack
frame of the top-level sys_connect handler). They are then copied by
llcp_sock_connect() into internal storage (nfc_llcp_sock structure), and
could be subsequently read back through the user-mode getsockname()
function (handled by llcp_sock_getname()). This would result in the
disclosure of up to ~70 uninitialized bytes from the kernel stack to
user-mode clients capable of creating AFC_NFC sockets.

Signed-off-by: Mateusz Jurczyk <mjurczyk@google.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-06-23 00:26:19 +02:00
..
hci networking: add and use skb_put_u8() 2017-06-16 11:48:40 -04:00
nci NFC: fix broken device allocation 2017-06-18 23:57:58 +02:00
af_nfc.c net: socket: mark socket protocol handler structs as const 2017-05-16 11:54:07 -04:00
core.c NFC: fix broken device allocation 2017-06-18 23:57:58 +02:00
digital_core.c NFC: digital: Delete an error message for memory allocation failure 2017-06-23 00:14:12 +02:00
digital_dep.c NFC: digital: NFC-DEP Target WT(nfcdep,max) is now 14 2017-06-23 00:19:59 +02:00
digital_technology.c NFC: digital: NFC-A SEL_RES must be one byte 2017-06-23 00:19:59 +02:00
digital.h
Kconfig
llcp_commands.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
llcp_core.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
llcp_sock.c nfc: Fix the sockaddr length sanitization in llcp_sock_connect 2017-06-23 00:26:19 +02:00
llcp.h net: Pass kern from net_proto_family.create to sk_alloc 2015-05-11 10:50:17 -04:00
Makefile
netlink.c NFC 4.12 pull request 2017-04-21 15:29:40 -04:00
nfc.h nfc: netlink: HCI event connectivity implementation 2015-12-29 19:06:20 +01:00
rawsock.c networking: make skb_push & __skb_push return void pointers 2017-06-16 11:48:40 -04:00