Skip to contentSkip to conversation

Bluetooth: Fix incorrectly overriding conn->src_type

PATCH Superseded [email protected] 2 participants 3 messages Jun 5, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: Fix incorrectly overriding conn->src_type

From: Johan Hedberg <[email protected]>

The src_type member of struct hci_conn should always reflect the address type of the src_member. It should never be overridden. There is already code in place in the command status handler of HCI_LE_Create_Connection to copy the right initiator address into conn->init_addr_type.

Without this patch, if privacy is enable, e.g. disconnection events to user space will contain the identity address by the wrong address type (e.g. public address with random address type).

---
 net/bluetooth/hci_conn.c | 5 -----
 1 file changed, 5 deletions(-)
net/bluetooth/hci_conn.c +0 -5
index 1bb8900086dd..7430001570d9 100644
@@ -610,11 +610,6 @@ static void hci_req_add_le_create_conn(struct hci_request *req,
 	if (hci_update_random_address(req, false, &own_addr_type))
 		return;
 
-	/* Save the address type used for this connnection attempt so we able
-	 * to retrieve this information if we need it.
-	 */
-	conn->src_type = own_addr_type;
-
 	cp.scan_interval = cpu_to_le16(hdev->le_scan_interval);
 	cp.scan_window = cpu_to_le16(hdev->le_scan_window);
 	bacpy(&cp.peer_addr, &conn->dst);
Signature · 1 line
1.9.3
#1 lore raw

PATCH v2 1/1 Bluetooth: Fix incorrectly overriding conn->src_type

From: Johan Hedberg <[email protected]>

The src_type member of struct hci_conn should always reflect the address type of the src_member. It should never be overridden. There is already code in place in the command status handler of HCI_LE_Create_Connection to copy the right initiator address into conn->init_addr_type.

Without this patch, if privacy is enabled, we will send the wrong address type in the SMP identity address information PDU (it'll e.g. contain our public address but a random address type).

---
v2: Reworded misleading commit message

 net/bluetooth/hci_conn.c | 5 -----
 1 file changed, 5 deletions(-)
net/bluetooth/hci_conn.c +0 -5
index 1bb8900086dd..7430001570d9 100644
@@ -610,11 +610,6 @@ static void hci_req_add_le_create_conn(struct hci_request *req,
 	if (hci_update_random_address(req, false, &own_addr_type))
 		return;
 
-	/* Save the address type used for this connnection attempt so we able
-	 * to retrieve this information if we need it.
-	 */
-	conn->src_type = own_addr_type;
-
 	cp.scan_interval = cpu_to_le16(hdev->le_scan_interval);
 	cp.scan_window = cpu_to_le16(hdev->le_scan_window);
 	bacpy(&cp.peer_addr, &conn->dst);
Signature · 1 line
1.9.3
maintainer
#2 lore raw

Hi Johan,

Quoted 9 lines

The src_type member of struct hci_conn should always reflect the address type of the src_member. It should never be overridden. There is already code in place in the command status handler of HCI_LE_Create_Connection to copy the right initiator address into conn->init_addr_type.

Without this patch, if privacy is enabled, we will send the wrong address type in the SMP identity address information PDU (it'll e.g. contain our public address but a random address type).

Quoted 6 lines

---
v2: Reworded misleading commit message

net/bluetooth/hci_conn.c | 5 -----

1 file changed, 5 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel