From: Marcel Holtmann Date: Mon, 26 Aug 2013 07:06:30 +0000 (-0700) Subject: Bluetooth: Fix handling of getpeername() for HCI sockets X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=06f43cbc4d61922d5a14c28909f02ae9c7fc5283;p=deliverable%2Flinux.git Bluetooth: Fix handling of getpeername() for HCI sockets The HCI sockets do not have a peer associated with it and so make sure that getpeername() returns EOPNOTSUPP since this operation is actually not supported on HCI sockets. Signed-off-by: Marcel Holtmann Signed-off-by: Gustavo Padovan --- diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index c45ec25aefb9..d8589410142f 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -699,6 +699,9 @@ static int hci_sock_getname(struct socket *sock, struct sockaddr *addr, BT_DBG("sock %p sk %p", sock, sk); + if (peer) + return -EOPNOTSUPP; + if (!hdev) return -EBADFD;