Skip to content

Commit

Permalink
Bluetooth: Return proper mgmt state when LE pairing connection failed
Browse files Browse the repository at this point in the history
MGMT_STATUS_BUSY should be returned when LE pairing cannot be started due
to another outgoing connection attempt is ongoing.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
  • Loading branch information
Andrzej Kaczmarek authored and Johan Hedberg committed Jun 5, 2012
1 parent dfc94db commit 489dc48
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1911,8 +1911,15 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
rp.addr.type = cp->addr.type;

if (IS_ERR(conn)) {
int status;

if (PTR_ERR(conn) == -EBUSY)
status = MGMT_STATUS_BUSY;
else
status = MGMT_STATUS_CONNECT_FAILED;

err = cmd_complete(sk, hdev->id, MGMT_OP_PAIR_DEVICE,
MGMT_STATUS_CONNECT_FAILED, &rp,
status, &rp,
sizeof(rp));
goto unlock;
}
Expand Down

0 comments on commit 489dc48

Please sign in to comment.