Bluetooth: fix possible info leak in bt_sock_recvmsg()
authorMathias Krause <minipli@googlemail.com>
Sun, 7 Apr 2013 01:51:49 +0000 (01:51 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 7 Apr 2013 20:28:00 +0000 (16:28 -0400)
commit4683f42fde3977bdb4e8a09622788cc8b5313778
tree37e0e2bd2666e7bcedd6630b029d88f740b3ddc7
parentef3313e84acbf349caecae942ab3ab731471f1a1
Bluetooth: fix possible info leak in bt_sock_recvmsg()

In case the socket is already shutting down, bt_sock_recvmsg() returns
with 0 without updating msg_namelen leading to net/socket.c leaking the
local, uninitialized sockaddr_storage variable to userland -- 128 bytes
of kernel stack memory.

Fix this by moving the msg_namelen assignment in front of the shutdown
test.

Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Gustavo Padovan <gustavo@padovan.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bluetooth/af_bluetooth.c