From: Andrzej Kaczmarek Date: Wed, 30 May 2012 13:39:22 +0000 (+0200) Subject: Bluetooth: Return proper mgmt state when LE pairing connection failed X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=489dc48e7583d825304b0aff3fc17e706627b3c8;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git Bluetooth: Return proper mgmt state when LE pairing connection failed 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 Signed-off-by: Gustavo Padovan --- diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 205574edff20..958f764cc6ab 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -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; }