Revert "NFC: llcp: fix info leaks via msg_name in llcp_sock_recvmsg()"

This reverts commit 0e8e0a9e59a7a1aec4e5490e632a412a69fbed37.

This patch prevents the UPSTREAM patch
fad2e371bb5a9f64dced90309fa7cb8bce09e92f from applying due to a
conflict. The patch is getting re-applied in CL
I1de86d2abfaadebf242ce946d5c66fa010ea5adc.

BUG=chromium:317437
CQ-DEPEND=CL:I1de86d2abfaadebf242ce946d5c66fa010ea5adc
TEST=Tested on an SCL3711 PN533 based USB NFC adapter, via neard 0.13.

Change-Id: Ie68a3ed0fdb03dbb3848fa437e06def00e4c2fb7
Signed-off-by: Arman Uguray <armansito@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/179556
UPSTREAM: NFC: Avoid memcpy on LLCP connection less Rx path

We can cast msg_name to a sockaddr_nfc_llcp pointer directly.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
(cherry picked from commit fad2e371bb5a9f64dced90309fa7cb8bce09e92f)

BUG=chromium:317437
TEST=Tested on an SCL3711 PN533 based USB NFC adapter, via neard 0.13.

Change-Id: I9d3beff5e6e9514bb018b7772b7b931b9f4f8633
Signed-off-by: Arman Uguray <armansito@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/179557
UPSTREAM: NFC: llcp: fix info leaks via msg_name in llcp_sock_recvmsg()

The code in llcp_sock_recvmsg() does not initialize all the members of
struct sockaddr_nfc_llcp when filling the sockaddr info. Nor does it
initialize the padding bytes of the structure inserted by the compiler
for alignment.

Also, if the socket is in state LLCP_CLOSED or is shutting down during
receive the msg_namelen member is not updated to 0 while otherwise
returning with 0, i.e. "success". The msg_namelen update is also
missing for stream and seqpacket sockets which don't fill the sockaddr
info.

Both issues lead to the fact that the code will leak uninitialized
kernel stack bytes in net/socket.c.

Fix the first issue by initializing the memory used for sockaddr info
with memset(0). Fix the second one by setting msg_namelen to 0 early.
It will be updated later if we're going to fill the msg_name member.

Cc: Lauro Ramos Venancio <lauro.venancio@openbossa.org>
Cc: Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d26d6504f23e803824e8ebd14e52d4fc0a0b09cb)

BUG=chromium:317437
CQ-DEPEND=CL:Ie68a3ed0fdb03dbb3848fa437e06def00e4c2fb7
TEST=Tested on an SCL3711 PN533 based USB NFC adapter, via neard 0.13.

Change-Id: I1de86d2abfaadebf242ce946d5c66fa010ea5adc
Signed-off-by: Arman Uguray <armansito@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/179558