Bluetooth: Fix error handling for HCI socket options
Subsystems (2)
Marcel Holtmann
maintainerPATCH 1/1 Bluetooth: Fix error handling for HCI socket options
The HCI sockets for monitor and control do not support any HCI specific socket options and if tried, an error will be returned. However the error used is EINVAL and that is not really descriptive. To make it clear that these sockets are not handling HCI socket options, return EBADFD instead.
--- net/bluetooth/hci_sock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/bluetooth/hci_sock.c +2 -2
@@ -921,7 +921,7 @@ static int hci_sock_setsockopt(struct socket *sock, int level, int optname,lock_sock (sk);if (hci_pi (sk)->channel !=HCI_CHANNEL_RAW ) { - err = -EINVAL ; + err = -EBADFD ; goto done; }
@@ -1007,7 +1007,7 @@ static int hci_sock_getsockopt(struct socket *sock, int level, int optname,lock_sock (sk);if (hci_pi (sk)->channel !=HCI_CHANNEL_RAW ) { - err = -EINVAL ; + err = -EBADFD ; goto done; }
Signature · 1 line
1.8.3.1
Hi Marcel,
2013-08-26 Marcel Holtmann <[email protected]>:
Quoted 10 lines
The HCI sockets for monitor and control do not support any HCI specific socket options and if tried, an error will be returned. However the error used is EINVAL and that is not really descriptive. To make it clear that these sockets are not handling HCI socket options, return EBADFD instead.
Signed-off-by Marcel Holtmann <[email protected]>--- net/bluetooth/hci_sock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Patch has been applied to bluetooth-next. Thanks.
Gustavo