diff options
Diffstat (limited to 'net/bluetooth')
| -rw-r--r-- | net/bluetooth/hci_core.c | 4 | ||||
| -rw-r--r-- | net/bluetooth/mgmt.c | 12 | ||||
| -rw-r--r-- | net/bluetooth/smp.c | 8 | 
3 files changed, 14 insertions, 10 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8a0ce706aeb..a0a2f97b9c6 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -1754,11 +1754,11 @@ int hci_register_dev(struct hci_dev *hdev)  	if (hdev->dev_type != HCI_AMP)  		set_bit(HCI_AUTO_OFF, &hdev->dev_flags); -	schedule_work(&hdev->power_on); -  	hci_notify(hdev, HCI_DEV_REG);  	hci_dev_hold(hdev); +	schedule_work(&hdev->power_on); +  	return id;  err_wqueue: diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index aa2ea0a8142..91de4239da6 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -326,7 +326,7 @@ static int read_index_list(struct sock *sk, struct hci_dev *hdev, void *data,  	struct hci_dev *d;  	size_t rp_len;  	u16 count; -	int i, err; +	int err;  	BT_DBG("sock %p", sk); @@ -347,9 +347,7 @@ static int read_index_list(struct sock *sk, struct hci_dev *hdev, void *data,  		return -ENOMEM;  	} -	rp->num_controllers = cpu_to_le16(count); - -	i = 0; +	count = 0;  	list_for_each_entry(d, &hci_dev_list, list) {  		if (test_bit(HCI_SETUP, &d->dev_flags))  			continue; @@ -357,10 +355,13 @@ static int read_index_list(struct sock *sk, struct hci_dev *hdev, void *data,  		if (!mgmt_valid_hdev(d))  			continue; -		rp->index[i++] = cpu_to_le16(d->id); +		rp->index[count++] = cpu_to_le16(d->id);  		BT_DBG("Added hci%u", d->id);  	} +	rp->num_controllers = cpu_to_le16(count); +	rp_len = sizeof(*rp) + (2 * count); +  	read_unlock(&hci_dev_list_lock);  	err = cmd_complete(sk, MGMT_INDEX_NONE, MGMT_OP_READ_INDEX_LIST, 0, rp, @@ -1366,6 +1367,7 @@ static int remove_uuid(struct sock *sk, struct hci_dev *hdev, void *data,  			continue;  		list_del(&match->list); +		kfree(match);  		found++;  	} diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 8c225ef349c..a5923378bdf 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c @@ -32,6 +32,8 @@  #define SMP_TIMEOUT	msecs_to_jiffies(30000) +#define AUTH_REQ_MASK   0x07 +  static inline void swap128(u8 src[16], u8 dst[16])  {  	int i; @@ -230,7 +232,7 @@ static void build_pairing_cmd(struct l2cap_conn *conn,  		req->max_key_size = SMP_MAX_ENC_KEY_SIZE;  		req->init_key_dist = 0;  		req->resp_key_dist = dist_keys; -		req->auth_req = authreq; +		req->auth_req = (authreq & AUTH_REQ_MASK);  		return;  	} @@ -239,7 +241,7 @@ static void build_pairing_cmd(struct l2cap_conn *conn,  	rsp->max_key_size = SMP_MAX_ENC_KEY_SIZE;  	rsp->init_key_dist = 0;  	rsp->resp_key_dist = req->resp_key_dist & dist_keys; -	rsp->auth_req = authreq; +	rsp->auth_req = (authreq & AUTH_REQ_MASK);  }  static u8 check_enc_key_size(struct l2cap_conn *conn, __u8 max_key_size) @@ -265,7 +267,7 @@ static void smp_failure(struct l2cap_conn *conn, u8 reason, u8 send)  	clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->hcon->flags);  	mgmt_auth_failed(conn->hcon->hdev, conn->dst, hcon->type, -			 hcon->dst_type, reason); +			 hcon->dst_type, HCI_ERROR_AUTH_FAILURE);  	cancel_delayed_work_sync(&conn->security_timer);  |