[PATCH] Bluetooth: Fix not sending command complete for add remote OOB data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add Remote OOB Data management command should generate Command Complete
event on failure.

Signed-off-by: Szymon Janc <szymon.janc@xxxxxxxxx>
---
 net/bluetooth/mgmt.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index cbeef5f..b5cd4c5 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3629,9 +3629,16 @@ static int add_remote_oob_data(struct sock *sk, struct hci_dev *hdev,
 		err = cmd_complete(sk, hdev->id, MGMT_OP_ADD_REMOTE_OOB_DATA,
 				   status, &cp->addr, sizeof(cp->addr));
 	} else {
+		struct mgmt_cp_add_remote_oob_data *cp = data;
+
+		/* It is safe to cast data to mgmt_cp_add_remote_oob_data cause
+		 * len is always >= MGMT_ADD_REMOTE_OOB_DATA_SIZE here.
+		 */
+
 		BT_ERR("add_remote_oob_data: invalid length of %u bytes", len);
-		err = cmd_status(sk, hdev->id, MGMT_OP_ADD_REMOTE_OOB_DATA,
-				 MGMT_STATUS_INVALID_PARAMS);
+		err = cmd_complete(sk, hdev->id, MGMT_OP_ADD_REMOTE_OOB_DATA,
+				   MGMT_STATUS_INVALID_PARAMS,
+				   &cp->addr, sizeof(cp->addr));
 	}
 
 unlock:
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux