Commit 7e21addcd0ad87696c17409399e56e874931da57

Authored by Marcel Holtmann
1 parent 2da31939a4

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>

Showing 1 changed file with 5 additions and 0 deletions Side-by-side Diff

net/bluetooth/hci_sock.c
... ... @@ -414,6 +414,11 @@
414 414 goto done;
415 415 }
416 416  
  417 + if (!test_bit(HCI_UP, &hdev->flags)) {
  418 + err = -ENETDOWN;
  419 + goto done;
  420 + }
  421 +
417 422 if (!(skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err)))
418 423 goto done;
419 424