diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-11-17 19:05:00 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-12-03 13:34:20 -0500 |
commit | 7e21addcd0ad87696c17409399e56e874931da57 (patch) | |
tree | 98a1f7a02dfa1db6d3c67565982f367ace68929c /net/bluetooth/hci_sock.c | |
parent | 2da31939a42f7a676a0bc5155d6a0a39ed8451f2 (diff) |
Bluetooth: Return ENETDOWN when interface is down
Sending commands to a down interface results in a timeout while clearly
it should just return ENETDOWN. When using the ioctls this works fine,
but not when using the HCI sockets sendmsg interface.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_sock.c')
-rw-r--r-- | net/bluetooth/hci_sock.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 1ca5c7ca9bd4..c3701f37aeb0 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -414,6 +414,11 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
414 | goto done; | 414 | goto done; |
415 | } | 415 | } |
416 | 416 | ||
417 | if (!test_bit(HCI_UP, &hdev->flags)) { | ||
418 | err = -ENETDOWN; | ||
419 | goto done; | ||
420 | } | ||
421 | |||
417 | if (!(skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err))) | 422 | if (!(skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err))) |
418 | goto done; | 423 | goto done; |
419 | 424 | ||