Skip to content

Commit

Permalink
Bluetooth: Return ENETDOWN when interface is down
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marcel Holtmann committed Dec 3, 2009
1 parent 2da3193 commit 7e21add
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions net/bluetooth/hci_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,11 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
goto done;
}

if (!test_bit(HCI_UP, &hdev->flags)) {
err = -ENETDOWN;
goto done;
}

if (!(skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err)))
goto done;

Expand Down

0 comments on commit 7e21add

Please sign in to comment.