Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c7c12e0 authored by David S. Miller's avatar David S. Miller
Browse files


Johan Hedberg says:

====================
pull request: bluetooth 2018-04-08

Here's one important Bluetooth fix for the 4.17-rc series that's needed
to pass several Bluetooth qualification test cases.

Let me know if there are any issues pulling. Thanks.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents fc56be47 082f2300
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -895,7 +895,7 @@ struct hci_conn *hci_connect_le_scan(struct hci_dev *hdev, bdaddr_t *dst,
				     u16 conn_timeout);
				     u16 conn_timeout);
struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
				u8 dst_type, u8 sec_level, u16 conn_timeout,
				u8 dst_type, u8 sec_level, u16 conn_timeout,
				u8 role);
				u8 role, bdaddr_t *direct_rpa);
struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst,
struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst,
				 u8 sec_level, u8 auth_type);
				 u8 sec_level, u8 auth_type);
struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst,
struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst,
+21 −8
Original line number Original line Diff line number Diff line
@@ -749,18 +749,31 @@ static bool conn_use_rpa(struct hci_conn *conn)
}
}


static void hci_req_add_le_create_conn(struct hci_request *req,
static void hci_req_add_le_create_conn(struct hci_request *req,
				       struct hci_conn *conn)
				       struct hci_conn *conn,
				       bdaddr_t *direct_rpa)
{
{
	struct hci_cp_le_create_conn cp;
	struct hci_cp_le_create_conn cp;
	struct hci_dev *hdev = conn->hdev;
	struct hci_dev *hdev = conn->hdev;
	u8 own_addr_type;
	u8 own_addr_type;


	/* If direct address was provided we use it instead of current
	 * address.
	 */
	if (direct_rpa) {
		if (bacmp(&req->hdev->random_addr, direct_rpa))
			hci_req_add(req, HCI_OP_LE_SET_RANDOM_ADDR, 6,
								direct_rpa);

		/* direct address is always RPA */
		own_addr_type = ADDR_LE_DEV_RANDOM;
	} else {
		/* Update random address, but set require_privacy to false so
		/* Update random address, but set require_privacy to false so
		 * that we never connect with an non-resolvable address.
		 * that we never connect with an non-resolvable address.
		 */
		 */
		if (hci_update_random_address(req, false, conn_use_rpa(conn),
		if (hci_update_random_address(req, false, conn_use_rpa(conn),
					      &own_addr_type))
					      &own_addr_type))
			return;
			return;
	}


	memset(&cp, 0, sizeof(cp));
	memset(&cp, 0, sizeof(cp));


@@ -825,7 +838,7 @@ static void hci_req_directed_advertising(struct hci_request *req,


struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
				u8 dst_type, u8 sec_level, u16 conn_timeout,
				u8 dst_type, u8 sec_level, u16 conn_timeout,
				u8 role)
				u8 role, bdaddr_t *direct_rpa)
{
{
	struct hci_conn_params *params;
	struct hci_conn_params *params;
	struct hci_conn *conn;
	struct hci_conn *conn;
@@ -940,7 +953,7 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
		hci_dev_set_flag(hdev, HCI_LE_SCAN_INTERRUPTED);
		hci_dev_set_flag(hdev, HCI_LE_SCAN_INTERRUPTED);
	}
	}


	hci_req_add_le_create_conn(&req, conn);
	hci_req_add_le_create_conn(&req, conn, direct_rpa);


create_conn:
create_conn:
	err = hci_req_run(&req, create_le_conn_complete);
	err = hci_req_run(&req, create_le_conn_complete);
+11 −4
Original line number Original line Diff line number Diff line
@@ -4648,7 +4648,8 @@ static void hci_le_conn_update_complete_evt(struct hci_dev *hdev,
/* This function requires the caller holds hdev->lock */
/* This function requires the caller holds hdev->lock */
static struct hci_conn *check_pending_le_conn(struct hci_dev *hdev,
static struct hci_conn *check_pending_le_conn(struct hci_dev *hdev,
					      bdaddr_t *addr,
					      bdaddr_t *addr,
					      u8 addr_type, u8 adv_type)
					      u8 addr_type, u8 adv_type,
					      bdaddr_t *direct_rpa)
{
{
	struct hci_conn *conn;
	struct hci_conn *conn;
	struct hci_conn_params *params;
	struct hci_conn_params *params;
@@ -4699,7 +4700,8 @@ static struct hci_conn *check_pending_le_conn(struct hci_dev *hdev,
	}
	}


	conn = hci_connect_le(hdev, addr, addr_type, BT_SECURITY_LOW,
	conn = hci_connect_le(hdev, addr, addr_type, BT_SECURITY_LOW,
			      HCI_LE_AUTOCONN_TIMEOUT, HCI_ROLE_MASTER);
			      HCI_LE_AUTOCONN_TIMEOUT, HCI_ROLE_MASTER,
			      direct_rpa);
	if (!IS_ERR(conn)) {
	if (!IS_ERR(conn)) {
		/* If HCI_AUTO_CONN_EXPLICIT is set, conn is already owned
		/* If HCI_AUTO_CONN_EXPLICIT is set, conn is already owned
		 * by higher layer that tried to connect, if no then
		 * by higher layer that tried to connect, if no then
@@ -4808,8 +4810,13 @@ static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,
		bdaddr_type = irk->addr_type;
		bdaddr_type = irk->addr_type;
	}
	}


	/* Check if we have been requested to connect to this device */
	/* Check if we have been requested to connect to this device.
	conn = check_pending_le_conn(hdev, bdaddr, bdaddr_type, type);
	 *
	 * direct_addr is set only for directed advertising reports (it is NULL
	 * for advertising reports) and is already verified to be RPA above.
	 */
	conn = check_pending_le_conn(hdev, bdaddr, bdaddr_type, type,
								direct_addr);
	if (conn && type == LE_ADV_IND) {
	if (conn && type == LE_ADV_IND) {
		/* Store report for later inclusion by
		/* Store report for later inclusion by
		 * mgmt_device_connected
		 * mgmt_device_connected
+1 −1
Original line number Original line Diff line number Diff line
@@ -7156,7 +7156,7 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
			hcon = hci_connect_le(hdev, dst, dst_type,
			hcon = hci_connect_le(hdev, dst, dst_type,
					      chan->sec_level,
					      chan->sec_level,
					      HCI_LE_CONN_TIMEOUT,
					      HCI_LE_CONN_TIMEOUT,
					      HCI_ROLE_SLAVE);
					      HCI_ROLE_SLAVE, NULL);
		else
		else
			hcon = hci_connect_le_scan(hdev, dst, dst_type,
			hcon = hci_connect_le_scan(hdev, dst, dst_type,
						   chan->sec_level,
						   chan->sec_level,