From: Marcel Holtmann Date: Wed, 18 Nov 2009 00:05:00 +0000 (+0100) Subject: Bluetooth: Return ENETDOWN when interface is down X-Git-Tag: v2.6.33-rc1~388^2~17^2~12 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=7e21addcd0ad87696c17409399e56e874931da57;p=~emulex%2Finfiniband.git 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 --- diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 1ca5c7ca9bd..c3701f37aeb 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, 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;