From ea4bd8ba804dedefa65303b3bd105d6d2808e621 Mon Sep 17 00:00:00 2001 From: David Miller Date: Fri, 30 Jul 2010 21:54:49 -0700 Subject: Bluetooth: Use list_head for HCI blacklist head The bdaddr in the list root is completely unused and just taking up space. Signed-off-by: David S. Miller Tested-by: Johan Hedberg Signed-off-by: Marcel Holtmann --- net/bluetooth/hci_core.c | 2 +- net/bluetooth/hci_sock.c | 8 +++----- net/bluetooth/hci_sysfs.c | 3 +-- 3 files changed, 5 insertions(+), 8 deletions(-) (limited to 'net') diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8303f1c9ef5..c52f091ee6d 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -924,7 +924,7 @@ int hci_register_dev(struct hci_dev *hdev) hci_conn_hash_init(hdev); - INIT_LIST_HEAD(&hdev->blacklist.list); + INIT_LIST_HEAD(&hdev->blacklist); memset(&hdev->stat, 0, sizeof(struct hci_dev_stats)); diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 4f170a59593..83acd164d39 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -168,9 +168,8 @@ static int hci_sock_release(struct socket *sock) struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr) { struct list_head *p; - struct bdaddr_list *blacklist = &hdev->blacklist; - list_for_each(p, &blacklist->list) { + list_for_each(p, &hdev->blacklist) { struct bdaddr_list *b; b = list_entry(p, struct bdaddr_list, list); @@ -202,7 +201,7 @@ static int hci_blacklist_add(struct hci_dev *hdev, void __user *arg) bacpy(&entry->bdaddr, &bdaddr); - list_add(&entry->list, &hdev->blacklist.list); + list_add(&entry->list, &hdev->blacklist); return 0; } @@ -210,9 +209,8 @@ static int hci_blacklist_add(struct hci_dev *hdev, void __user *arg) int hci_blacklist_clear(struct hci_dev *hdev) { struct list_head *p, *n; - struct bdaddr_list *blacklist = &hdev->blacklist; - list_for_each_safe(p, n, &blacklist->list) { + list_for_each_safe(p, n, &hdev->blacklist) { struct bdaddr_list *b; b = list_entry(p, struct bdaddr_list, list); diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index ce44c47eeac..8fb967beee8 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -439,12 +439,11 @@ static const struct file_operations inquiry_cache_fops = { static int blacklist_show(struct seq_file *f, void *p) { struct hci_dev *hdev = f->private; - struct bdaddr_list *blacklist = &hdev->blacklist; struct list_head *l; hci_dev_lock_bh(hdev); - list_for_each(l, &blacklist->list) { + list_for_each(l, &hdev->blacklist) { struct bdaddr_list *b; bdaddr_t bdaddr; -- cgit v1.2.3-70-g09d2 From 28e9509b1270e5cfa8bb3c5ff51f39214aa09262 Mon Sep 17 00:00:00 2001 From: "Gustavo F. Padovan" Date: Sat, 31 Jul 2010 19:57:05 -0300 Subject: Bluetooth: Remove __exit from rfcomm_cleanup_ttys() rfcomm_cleanup_ttys() is also called from rfcomm_init(), so it can't have __exit. Reported-by: Mat Martineau Signed-off-by: Gustavo F. Padovan Signed-off-by: Marcel Holtmann --- net/bluetooth/rfcomm/tty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net') diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 026205c18b7..befc3a52aa0 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c @@ -1183,7 +1183,7 @@ int __init rfcomm_init_ttys(void) return 0; } -void __exit rfcomm_cleanup_ttys(void) +void rfcomm_cleanup_ttys(void) { tty_unregister_driver(rfcomm_tty_driver); put_tty_driver(rfcomm_tty_driver); -- cgit v1.2.3-70-g09d2 From 6340650400525a9ca8d86b1b4501cc50670dce0d Mon Sep 17 00:00:00 2001 From: "Gustavo F. Padovan" Date: Tue, 3 Aug 2010 23:49:29 -0300 Subject: Bluetooth: Don't send RFC for Basic Mode if only it is supported If the remote side doesn't support Enhanced Retransmission Mode neither Streaming Mode, we shall not send the RFC option. Some devices that only supports Basic Mode do not understanding the RFC option. This patch fixes the regression found with these devices. Signed-off-by: Gustavo F. Padovan Signed-off-by: Marcel Holtmann --- net/bluetooth/l2cap.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'net') diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 9ba1e8eee37..0f34e127514 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c @@ -2527,6 +2527,10 @@ done: if (pi->imtu != L2CAP_DEFAULT_MTU) l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->imtu); + if (!(pi->conn->feat_mask & L2CAP_FEAT_ERTM) && + !(pi->conn->feat_mask & L2CAP_FEAT_STREAMING)) + break; + rfc.mode = L2CAP_MODE_BASIC; rfc.txwin_size = 0; rfc.max_transmit = 0; @@ -2534,6 +2538,8 @@ done: rfc.monitor_timeout = 0; rfc.max_pdu_size = 0; + l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, sizeof(rfc), + (unsigned long) &rfc); break; case L2CAP_MODE_ERTM: @@ -2546,6 +2552,9 @@ done: if (L2CAP_DEFAULT_MAX_PDU_SIZE > pi->conn->mtu - 10) rfc.max_pdu_size = cpu_to_le16(pi->conn->mtu - 10); + l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, sizeof(rfc), + (unsigned long) &rfc); + if (!(pi->conn->feat_mask & L2CAP_FEAT_FCS)) break; @@ -2566,6 +2575,9 @@ done: if (L2CAP_DEFAULT_MAX_PDU_SIZE > pi->conn->mtu - 10) rfc.max_pdu_size = cpu_to_le16(pi->conn->mtu - 10); + l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, sizeof(rfc), + (unsigned long) &rfc); + if (!(pi->conn->feat_mask & L2CAP_FEAT_FCS)) break; @@ -2577,9 +2589,6 @@ done: break; } - l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, sizeof(rfc), - (unsigned long) &rfc); - /* FIXME: Need actual value of the flush timeout */ //if (flush_to != L2CAP_DEFAULT_FLUSH_TO) // l2cap_add_conf_opt(&ptr, L2CAP_CONF_FLUSH_TO, 2, pi->flush_to); -- cgit v1.2.3-70-g09d2 From adb08edea0119f7a5484a9f6a385fbcecdf85a63 Mon Sep 17 00:00:00 2001 From: Ville Tervo Date: Wed, 4 Aug 2010 09:43:33 +0300 Subject: Bluetooth: Check result code of L2CAP information response Check result code of L2CAP information response. Otherwise it would read invalid feature mask and access invalid memory. Signed-off-by: Ville Tervo Signed-off-by: Marcel Holtmann --- net/bluetooth/l2cap.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'net') diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 0f34e127514..3e3cd9d4e52 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c @@ -3348,6 +3348,15 @@ static inline int l2cap_information_rsp(struct l2cap_conn *conn, struct l2cap_cm del_timer(&conn->info_timer); + if (result != L2CAP_IR_SUCCESS) { + conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_DONE; + conn->info_ident = 0; + + l2cap_conn_start(conn); + + return 0; + } + if (type == L2CAP_IT_FEAT_MASK) { conn->feat_mask = get_unaligned_le32(rsp->data); -- cgit v1.2.3-70-g09d2 From 1601b1e56e1093d6deb8f475fafc30cc30143357 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Fri, 30 Jul 2010 13:30:47 +0200 Subject: mac80211: fix scan locking wrt. hw scan Releasing the scan mutex while starting scans can lead to unexpected things happening, so we shouldn't do that. Fix that and hold the mutex across the scan triggering. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- net/mac80211/scan.c | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'net') diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 41f20fb7e67..872d7b6ef6b 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c @@ -400,19 +400,7 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata, else __set_bit(SCAN_SW_SCANNING, &local->scanning); - /* - * Kicking off the scan need not be protected, - * only the scan variable stuff, since now - * local->scan_req is assigned and other callers - * will abort their scan attempts. - * - * This avoids too many locking dependencies - * so that the scan completed calls have more - * locking freedom. - */ - ieee80211_recalc_idle(local); - mutex_unlock(&local->scan_mtx); if (local->ops->hw_scan) { WARN_ON(!ieee80211_prep_hw_scan(local)); @@ -420,8 +408,6 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata, } else rc = ieee80211_start_sw_scan(local); - mutex_lock(&local->scan_mtx); - if (rc) { kfree(local->hw_scan_req); local->hw_scan_req = NULL; -- cgit v1.2.3-70-g09d2 From 93c08c32914264f539baf7f04cce310a0dd30a7a Mon Sep 17 00:00:00 2001 From: Juuso Oikarinen Date: Tue, 3 Aug 2010 08:22:25 +0300 Subject: mac80211: Fix compilation warning when CONFIG_INET is not set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The warning is: net/mac80211/main.c:688: warning: label ‘fail_ifa’ defined but not used Signed-off-by: Juuso Oikarinen Signed-off-by: John W. Linville --- net/mac80211/main.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'net') diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 7cc4f913a43..798a91b100c 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -685,10 +685,12 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) return 0; +#ifdef CONFIG_INET fail_ifa: pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY, &local->network_latency_notifier); rtnl_lock(); +#endif fail_pm_qos: ieee80211_led_exit(local); ieee80211_remove_interfaces(local); -- cgit v1.2.3-70-g09d2