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

DORMANTno replies

From: Szymon Janc <hidden>
Date: 2014-11-18 16:33:10
Subsystem: bluetooth subsystem, the rest · Maintainers: Marcel Holtmann, Luiz Augusto von Dentz, Linus Torvalds

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

Signed-off-by: Szymon Janc <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help