Thread (2 messages) flat view 2 messages, 2 authors, 2013-09-01
STALE4739d

[PATCH] Bluetooth: Fix handling of getpeername() for HCI sockets

From: Marcel Holtmann <marcel@holtmann.org>
Date: 2013-08-26 07:06:30
Subsystem: bluetooth subsystem, the rest · Maintainers: Marcel Holtmann, Luiz Augusto von Dentz, Linus Torvalds

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 <marcel@holtmann.org>
---
 net/bluetooth/hci_sock.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index c45ec25..d858941 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;
 
-- 
1.8.3.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help