Commit 874c60ba authored by John W. Linville's avatar John W. Linville
Browse files
parents a8c1f65c c5993de8
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -127,7 +127,7 @@ struct hci_dev {
	__u8		major_class;
	__u8		major_class;
	__u8		minor_class;
	__u8		minor_class;
	__u8		features[8];
	__u8		features[8];
	__u8		extfeatures[8];
	__u8		host_features[8];
	__u8		commands[64];
	__u8		commands[64];
	__u8		ssp_mode;
	__u8		ssp_mode;
	__u8		hci_ver;
	__u8		hci_ver;
@@ -676,7 +676,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
#define lmp_le_capable(dev)        ((dev)->features[4] & LMP_LE)
#define lmp_le_capable(dev)        ((dev)->features[4] & LMP_LE)


/* ----- Extended LMP capabilities ----- */
/* ----- Extended LMP capabilities ----- */
#define lmp_host_le_capable(dev)   ((dev)->extfeatures[0] & LMP_HOST_LE)
#define lmp_host_le_capable(dev)   ((dev)->host_features[0] & LMP_HOST_LE)


/* ----- HCI protocols ----- */
/* ----- HCI protocols ----- */
static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
+4 −4
Original line number Original line Diff line number Diff line
@@ -156,17 +156,17 @@ static int bt_sock_create(struct net *net, struct socket *sock, int proto,


void bt_sock_link(struct bt_sock_list *l, struct sock *sk)
void bt_sock_link(struct bt_sock_list *l, struct sock *sk)
{
{
	write_lock_bh(&l->lock);
	write_lock(&l->lock);
	sk_add_node(sk, &l->head);
	sk_add_node(sk, &l->head);
	write_unlock_bh(&l->lock);
	write_unlock(&l->lock);
}
}
EXPORT_SYMBOL(bt_sock_link);
EXPORT_SYMBOL(bt_sock_link);


void bt_sock_unlink(struct bt_sock_list *l, struct sock *sk)
void bt_sock_unlink(struct bt_sock_list *l, struct sock *sk)
{
{
	write_lock_bh(&l->lock);
	write_lock(&l->lock);
	sk_del_node_init(sk);
	sk_del_node_init(sk);
	write_unlock_bh(&l->lock);
	write_unlock(&l->lock);
}
}
EXPORT_SYMBOL(bt_sock_unlink);
EXPORT_SYMBOL(bt_sock_unlink);


+13 −9
Original line number Original line Diff line number Diff line
@@ -711,7 +711,14 @@ static void hci_cc_read_local_ext_features(struct hci_dev *hdev,
	if (rp->status)
	if (rp->status)
		return;
		return;


	memcpy(hdev->extfeatures, rp->features, 8);
	switch (rp->page) {
	case 0:
		memcpy(hdev->features, rp->features, 8);
		break;
	case 1:
		memcpy(hdev->host_features, rp->features, 8);
		break;
	}


	hci_req_complete(hdev, HCI_OP_READ_LOCAL_EXT_FEATURES, rp->status);
	hci_req_complete(hdev, HCI_OP_READ_LOCAL_EXT_FEATURES, rp->status);
}
}
@@ -1047,9 +1054,7 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev,
	case LE_SCANNING_DISABLED:
	case LE_SCANNING_DISABLED:
		clear_bit(HCI_LE_SCAN, &hdev->dev_flags);
		clear_bit(HCI_LE_SCAN, &hdev->dev_flags);


		cancel_delayed_work_sync(&hdev->adv_work);
		schedule_delayed_work(&hdev->adv_work, ADV_CLEAR_TIMEOUT);
		queue_delayed_work(hdev->workqueue, &hdev->adv_work,
						 jiffies + ADV_CLEAR_TIMEOUT);
		break;
		break;


	default:
	default:
@@ -2266,20 +2271,19 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s
	struct hci_ev_num_comp_pkts *ev = (void *) skb->data;
	struct hci_ev_num_comp_pkts *ev = (void *) skb->data;
	int i;
	int i;


	skb_pull(skb, sizeof(*ev));

	BT_DBG("%s num_hndl %d", hdev->name, ev->num_hndl);

	if (hdev->flow_ctl_mode != HCI_FLOW_CTL_MODE_PACKET_BASED) {
	if (hdev->flow_ctl_mode != HCI_FLOW_CTL_MODE_PACKET_BASED) {
		BT_ERR("Wrong event for mode %d", hdev->flow_ctl_mode);
		BT_ERR("Wrong event for mode %d", hdev->flow_ctl_mode);
		return;
		return;
	}
	}


	if (skb->len < ev->num_hndl * 4) {
	if (skb->len < sizeof(*ev) || skb->len < sizeof(*ev) +
			ev->num_hndl * sizeof(struct hci_comp_pkts_info)) {
		BT_DBG("%s bad parameters", hdev->name);
		BT_DBG("%s bad parameters", hdev->name);
		return;
		return;
	}
	}


	BT_DBG("%s num_hndl %d", hdev->name, ev->num_hndl);

	for (i = 0; i < ev->num_hndl; i++) {
	for (i = 0; i < ev->num_hndl; i++) {
		struct hci_comp_pkts_info *info = &ev->handles[i];
		struct hci_comp_pkts_info *info = &ev->handles[i];
		struct hci_conn *conn;
		struct hci_conn *conn;
+0 −2
Original line number Original line Diff line number Diff line
@@ -767,7 +767,6 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,
		/* Detach sockets from device */
		/* Detach sockets from device */
		read_lock(&hci_sk_list.lock);
		read_lock(&hci_sk_list.lock);
		sk_for_each(sk, node, &hci_sk_list.head) {
		sk_for_each(sk, node, &hci_sk_list.head) {
			local_bh_disable();
			bh_lock_sock_nested(sk);
			bh_lock_sock_nested(sk);
			if (hci_pi(sk)->hdev == hdev) {
			if (hci_pi(sk)->hdev == hdev) {
				hci_pi(sk)->hdev = NULL;
				hci_pi(sk)->hdev = NULL;
@@ -778,7 +777,6 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,
				hci_dev_put(hdev);
				hci_dev_put(hdev);
			}
			}
			bh_unlock_sock(sk);
			bh_unlock_sock(sk);
			local_bh_enable();
		}
		}
		read_unlock(&hci_sk_list.lock);
		read_unlock(&hci_sk_list.lock);
	}
	}
+13 −13
Original line number Original line Diff line number Diff line
@@ -165,7 +165,7 @@ int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm)
{
{
	int err;
	int err;


	write_lock_bh(&chan_list_lock);
	write_lock(&chan_list_lock);


	if (psm && __l2cap_global_chan_by_addr(psm, src)) {
	if (psm && __l2cap_global_chan_by_addr(psm, src)) {
		err = -EADDRINUSE;
		err = -EADDRINUSE;
@@ -190,17 +190,17 @@ int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm)
	}
	}


done:
done:
	write_unlock_bh(&chan_list_lock);
	write_unlock(&chan_list_lock);
	return err;
	return err;
}
}


int l2cap_add_scid(struct l2cap_chan *chan,  __u16 scid)
int l2cap_add_scid(struct l2cap_chan *chan,  __u16 scid)
{
{
	write_lock_bh(&chan_list_lock);
	write_lock(&chan_list_lock);


	chan->scid = scid;
	chan->scid = scid;


	write_unlock_bh(&chan_list_lock);
	write_unlock(&chan_list_lock);


	return 0;
	return 0;
}
}
@@ -289,9 +289,9 @@ struct l2cap_chan *l2cap_chan_create(struct sock *sk)


	chan->sk = sk;
	chan->sk = sk;


	write_lock_bh(&chan_list_lock);
	write_lock(&chan_list_lock);
	list_add(&chan->global_l, &chan_list);
	list_add(&chan->global_l, &chan_list);
	write_unlock_bh(&chan_list_lock);
	write_unlock(&chan_list_lock);


	INIT_DELAYED_WORK(&chan->chan_timer, l2cap_chan_timeout);
	INIT_DELAYED_WORK(&chan->chan_timer, l2cap_chan_timeout);


@@ -306,9 +306,9 @@ struct l2cap_chan *l2cap_chan_create(struct sock *sk)


void l2cap_chan_destroy(struct l2cap_chan *chan)
void l2cap_chan_destroy(struct l2cap_chan *chan)
{
{
	write_lock_bh(&chan_list_lock);
	write_lock(&chan_list_lock);
	list_del(&chan->global_l);
	list_del(&chan->global_l);
	write_unlock_bh(&chan_list_lock);
	write_unlock(&chan_list_lock);


	l2cap_chan_put(chan);
	l2cap_chan_put(chan);
}
}
@@ -543,14 +543,14 @@ static u8 l2cap_get_ident(struct l2cap_conn *conn)
	 *  200 - 254 are used by utilities like l2ping, etc.
	 *  200 - 254 are used by utilities like l2ping, etc.
	 */
	 */


	spin_lock_bh(&conn->lock);
	spin_lock(&conn->lock);


	if (++conn->tx_ident > 128)
	if (++conn->tx_ident > 128)
		conn->tx_ident = 1;
		conn->tx_ident = 1;


	id = conn->tx_ident;
	id = conn->tx_ident;


	spin_unlock_bh(&conn->lock);
	spin_unlock(&conn->lock);


	return id;
	return id;
}
}
@@ -1190,7 +1190,7 @@ inline int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, bdad
	}
	}


	/* Set destination address and psm */
	/* Set destination address and psm */
	bacpy(&bt_sk(sk)->dst, src);
	bacpy(&bt_sk(sk)->dst, dst);
	chan->psm = psm;
	chan->psm = psm;
	chan->dcid = cid;
	chan->dcid = cid;


@@ -4702,7 +4702,7 @@ static int l2cap_debugfs_show(struct seq_file *f, void *p)
{
{
	struct l2cap_chan *c;
	struct l2cap_chan *c;


	read_lock_bh(&chan_list_lock);
	read_lock(&chan_list_lock);


	list_for_each_entry(c, &chan_list, global_l) {
	list_for_each_entry(c, &chan_list, global_l) {
		struct sock *sk = c->sk;
		struct sock *sk = c->sk;
@@ -4715,7 +4715,7 @@ static int l2cap_debugfs_show(struct seq_file *f, void *p)
					c->sec_level, c->mode);
					c->sec_level, c->mode);
}
}


	read_unlock_bh(&chan_list_lock);
	read_unlock(&chan_list_lock);


	return 0;
	return 0;
}
}
Loading