Skip to contentSkip to conversation

Bluetooth: Fix handling of getpeername() for HCI sockets

PATCH In review Marcel Holtmann 2 participants 2 messages Aug 26, 2013 – Sep 1, 2013

Subsystems (2)
lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

PATCH 1/1 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.

---
 net/bluetooth/hci_sock.c | 3 +++
 1 file changed, 3 insertions(+)
net/bluetooth/hci_sock.c +3 -0
index c45ec25..d858941 100644
@@ -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;
 
Signature · 1 line
1.8.3.1
#1 lore raw

Hi Marcel,

2013-08-26 Marcel Holtmann <[email protected]>:

Quoted 8 lines

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.

---
 net/bluetooth/hci_sock.c | 3 +++
 1 file changed, 3 insertions(+)

Patch has been applied to bluetooth-next. Thanks.

Gustavo