diff options
author | John W. Linville <linville@tuxdriver.com> | 2014-07-10 17:00:24 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-07-10 17:00:24 -0400 |
commit | 5c4d5e816c2cc86e17d09677b649be47fbc30e51 (patch) | |
tree | b13327e59b6ea29095b9b33b4cdd5dffab9a66d3 | |
parent | f473832fece16611520bf54ad52b16c3f6db0a94 (diff) | |
parent | 2c4db12ec469b9fcdad9f6bfd6fa20e65a563ac5 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
35 files changed, 303 insertions, 151 deletions
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index f98380648cb3..f50dffc0374f 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -90,7 +90,6 @@ static const struct usb_device_id ath3k_table[] = { | |||
90 | { USB_DEVICE(0x0b05, 0x17d0) }, | 90 | { USB_DEVICE(0x0b05, 0x17d0) }, |
91 | { USB_DEVICE(0x0CF3, 0x0036) }, | 91 | { USB_DEVICE(0x0CF3, 0x0036) }, |
92 | { USB_DEVICE(0x0CF3, 0x3004) }, | 92 | { USB_DEVICE(0x0CF3, 0x3004) }, |
93 | { USB_DEVICE(0x0CF3, 0x3005) }, | ||
94 | { USB_DEVICE(0x0CF3, 0x3008) }, | 93 | { USB_DEVICE(0x0CF3, 0x3008) }, |
95 | { USB_DEVICE(0x0CF3, 0x311D) }, | 94 | { USB_DEVICE(0x0CF3, 0x311D) }, |
96 | { USB_DEVICE(0x0CF3, 0x311E) }, | 95 | { USB_DEVICE(0x0CF3, 0x311E) }, |
@@ -140,7 +139,6 @@ static const struct usb_device_id ath3k_blist_tbl[] = { | |||
140 | { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 }, | 139 | { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 }, |
141 | { USB_DEVICE(0x0CF3, 0x0036), .driver_info = BTUSB_ATH3012 }, | 140 | { USB_DEVICE(0x0CF3, 0x0036), .driver_info = BTUSB_ATH3012 }, |
142 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | 141 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
143 | { USB_DEVICE(0x0cf3, 0x3005), .driver_info = BTUSB_ATH3012 }, | ||
144 | { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, | 142 | { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, |
145 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, | 143 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, |
146 | { USB_DEVICE(0x0cf3, 0x311E), .driver_info = BTUSB_ATH3012 }, | 144 | { USB_DEVICE(0x0cf3, 0x311E), .driver_info = BTUSB_ATH3012 }, |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index a1c80b0c7663..6250fc2fb93a 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -162,7 +162,6 @@ static const struct usb_device_id blacklist_table[] = { | |||
162 | { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 }, | 162 | { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 }, |
163 | { USB_DEVICE(0x0cf3, 0x0036), .driver_info = BTUSB_ATH3012 }, | 163 | { USB_DEVICE(0x0cf3, 0x0036), .driver_info = BTUSB_ATH3012 }, |
164 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | 164 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
165 | { USB_DEVICE(0x0cf3, 0x3005), .driver_info = BTUSB_ATH3012 }, | ||
166 | { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, | 165 | { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, |
167 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, | 166 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, |
168 | { USB_DEVICE(0x0cf3, 0x311e), .driver_info = BTUSB_ATH3012 }, | 167 | { USB_DEVICE(0x0cf3, 0x311e), .driver_info = BTUSB_ATH3012 }, |
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c index 04680ead9275..fede8ca7147c 100644 --- a/drivers/bluetooth/hci_h5.c +++ b/drivers/bluetooth/hci_h5.c | |||
@@ -406,6 +406,7 @@ static int h5_rx_3wire_hdr(struct hci_uart *hu, unsigned char c) | |||
406 | H5_HDR_PKT_TYPE(hdr) != HCI_3WIRE_LINK_PKT) { | 406 | H5_HDR_PKT_TYPE(hdr) != HCI_3WIRE_LINK_PKT) { |
407 | BT_ERR("Non-link packet received in non-active state"); | 407 | BT_ERR("Non-link packet received in non-active state"); |
408 | h5_reset_rx(h5); | 408 | h5_reset_rx(h5); |
409 | return 0; | ||
409 | } | 410 | } |
410 | 411 | ||
411 | h5->rx_func = h5_rx_payload; | 412 | h5->rx_func = h5_rx_payload; |
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 82017f56e661..e6c56c5bb0f6 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c | |||
@@ -795,7 +795,11 @@ int ath10k_core_start(struct ath10k *ar) | |||
795 | if (status) | 795 | if (status) |
796 | goto err_htc_stop; | 796 | goto err_htc_stop; |
797 | 797 | ||
798 | ar->free_vdev_map = (1 << TARGET_NUM_VDEVS) - 1; | 798 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) |
799 | ar->free_vdev_map = (1 << TARGET_10X_NUM_VDEVS) - 1; | ||
800 | else | ||
801 | ar->free_vdev_map = (1 << TARGET_NUM_VDEVS) - 1; | ||
802 | |||
799 | INIT_LIST_HEAD(&ar->arvifs); | 803 | INIT_LIST_HEAD(&ar->arvifs); |
800 | 804 | ||
801 | if (!test_bit(ATH10K_FLAG_FIRST_BOOT_DONE, &ar->dev_flags)) | 805 | if (!test_bit(ATH10K_FLAG_FIRST_BOOT_DONE, &ar->dev_flags)) |
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 6c102b1312ff..eebc860c3655 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c | |||
@@ -312,7 +312,6 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt, | |||
312 | int msdu_len, msdu_chaining = 0; | 312 | int msdu_len, msdu_chaining = 0; |
313 | struct sk_buff *msdu; | 313 | struct sk_buff *msdu; |
314 | struct htt_rx_desc *rx_desc; | 314 | struct htt_rx_desc *rx_desc; |
315 | bool corrupted = false; | ||
316 | 315 | ||
317 | lockdep_assert_held(&htt->rx_ring.lock); | 316 | lockdep_assert_held(&htt->rx_ring.lock); |
318 | 317 | ||
@@ -439,9 +438,6 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt, | |||
439 | last_msdu = __le32_to_cpu(rx_desc->msdu_end.info0) & | 438 | last_msdu = __le32_to_cpu(rx_desc->msdu_end.info0) & |
440 | RX_MSDU_END_INFO0_LAST_MSDU; | 439 | RX_MSDU_END_INFO0_LAST_MSDU; |
441 | 440 | ||
442 | if (msdu_chaining && !last_msdu) | ||
443 | corrupted = true; | ||
444 | |||
445 | if (last_msdu) { | 441 | if (last_msdu) { |
446 | msdu->next = NULL; | 442 | msdu->next = NULL; |
447 | break; | 443 | break; |
@@ -457,20 +453,6 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt, | |||
457 | msdu_chaining = -1; | 453 | msdu_chaining = -1; |
458 | 454 | ||
459 | /* | 455 | /* |
460 | * Apparently FW sometimes reports weird chained MSDU sequences with | ||
461 | * more than one rx descriptor. This seems like a bug but needs more | ||
462 | * analyzing. For the time being fix it by dropping such sequences to | ||
463 | * avoid blowing up the host system. | ||
464 | */ | ||
465 | if (corrupted) { | ||
466 | ath10k_warn("failed to pop chained msdus, dropping\n"); | ||
467 | ath10k_htt_rx_free_msdu_chain(*head_msdu); | ||
468 | *head_msdu = NULL; | ||
469 | *tail_msdu = NULL; | ||
470 | msdu_chaining = -EINVAL; | ||
471 | } | ||
472 | |||
473 | /* | ||
474 | * Don't refill the ring yet. | 456 | * Don't refill the ring yet. |
475 | * | 457 | * |
476 | * First, the elements popped here are still in use - it is not | 458 | * First, the elements popped here are still in use - it is not |
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig index 037a4e304d14..d4c6ae3a9210 100644 --- a/drivers/net/wireless/b43/Kconfig +++ b/drivers/net/wireless/b43/Kconfig | |||
@@ -36,7 +36,7 @@ config B43_SSB | |||
36 | choice | 36 | choice |
37 | prompt "Supported bus types" | 37 | prompt "Supported bus types" |
38 | depends on B43 | 38 | depends on B43 |
39 | default B43_BCMA_AND_SSB | 39 | default B43_BUSES_BCMA_AND_SSB |
40 | 40 | ||
41 | config B43_BUSES_BCMA_AND_SSB | 41 | config B43_BUSES_BCMA_AND_SSB |
42 | bool "BCMA and SSB" | 42 | bool "BCMA and SSB" |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index b2bc593a6513..15aaeb132a32 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -5250,6 +5250,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
5250 | /* We don't support 5 GHz on some PHYs yet */ | 5250 | /* We don't support 5 GHz on some PHYs yet */ |
5251 | switch (dev->phy.type) { | 5251 | switch (dev->phy.type) { |
5252 | case B43_PHYTYPE_A: | 5252 | case B43_PHYTYPE_A: |
5253 | case B43_PHYTYPE_G: | ||
5253 | case B43_PHYTYPE_N: | 5254 | case B43_PHYTYPE_N: |
5254 | case B43_PHYTYPE_LP: | 5255 | case B43_PHYTYPE_LP: |
5255 | case B43_PHYTYPE_HT: | 5256 | case B43_PHYTYPE_HT: |
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index 4f38f19b8e3d..6e6ef3fc2247 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c | |||
@@ -811,9 +811,13 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) | |||
811 | break; | 811 | break; |
812 | case B43_PHYTYPE_G: | 812 | case B43_PHYTYPE_G: |
813 | status.band = IEEE80211_BAND_2GHZ; | 813 | status.band = IEEE80211_BAND_2GHZ; |
814 | /* chanid is the radio channel cookie value as used | 814 | /* Somewhere between 478.104 and 508.1084 firmware for G-PHY |
815 | * to tune the radio. */ | 815 | * has been modified to be compatible with N-PHY and others. |
816 | status.freq = chanid + 2400; | 816 | */ |
817 | if (dev->fw.rev >= 508) | ||
818 | status.freq = ieee80211_channel_to_frequency(chanid, status.band); | ||
819 | else | ||
820 | status.freq = chanid + 2400; | ||
817 | break; | 821 | break; |
818 | case B43_PHYTYPE_N: | 822 | case B43_PHYTYPE_N: |
819 | case B43_PHYTYPE_LP: | 823 | case B43_PHYTYPE_LP: |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c index 839bcda9465a..b732a99e402c 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c | |||
@@ -1183,8 +1183,6 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) | |||
1183 | bus->bus_priv.usb = bus_pub; | 1183 | bus->bus_priv.usb = bus_pub; |
1184 | dev_set_drvdata(dev, bus); | 1184 | dev_set_drvdata(dev, bus); |
1185 | bus->ops = &brcmf_usb_bus_ops; | 1185 | bus->ops = &brcmf_usb_bus_ops; |
1186 | bus->chip = bus_pub->devid; | ||
1187 | bus->chiprev = bus_pub->chiprev; | ||
1188 | bus->proto_type = BRCMF_PROTO_BCDC; | 1186 | bus->proto_type = BRCMF_PROTO_BCDC; |
1189 | bus->always_use_fws_queue = true; | 1187 | bus->always_use_fws_queue = true; |
1190 | 1188 | ||
@@ -1193,6 +1191,9 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) | |||
1193 | if (ret) | 1191 | if (ret) |
1194 | goto fail; | 1192 | goto fail; |
1195 | } | 1193 | } |
1194 | bus->chip = bus_pub->devid; | ||
1195 | bus->chiprev = bus_pub->chiprev; | ||
1196 | |||
1196 | /* request firmware here */ | 1197 | /* request firmware here */ |
1197 | brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo), NULL, | 1198 | brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo), NULL, |
1198 | brcmf_usb_probe_phase2); | 1199 | brcmf_usb_probe_phase2); |
diff --git a/drivers/net/wireless/mwifiex/11n_aggr.c b/drivers/net/wireless/mwifiex/11n_aggr.c index b4c14b0fd3cb..8720a3d3c755 100644 --- a/drivers/net/wireless/mwifiex/11n_aggr.c +++ b/drivers/net/wireless/mwifiex/11n_aggr.c | |||
@@ -185,6 +185,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, | |||
185 | skb_reserve(skb_aggr, headroom + sizeof(struct txpd)); | 185 | skb_reserve(skb_aggr, headroom + sizeof(struct txpd)); |
186 | tx_info_aggr = MWIFIEX_SKB_TXCB(skb_aggr); | 186 | tx_info_aggr = MWIFIEX_SKB_TXCB(skb_aggr); |
187 | 187 | ||
188 | memset(tx_info_aggr, 0, sizeof(*tx_info_aggr)); | ||
188 | tx_info_aggr->bss_type = tx_info_src->bss_type; | 189 | tx_info_aggr->bss_type = tx_info_src->bss_type; |
189 | tx_info_aggr->bss_num = tx_info_src->bss_num; | 190 | tx_info_aggr->bss_num = tx_info_src->bss_num; |
190 | 191 | ||
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 15fa7b453372..6af135fa99f7 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -188,6 +188,7 @@ mwifiex_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, | |||
188 | } | 188 | } |
189 | 189 | ||
190 | tx_info = MWIFIEX_SKB_TXCB(skb); | 190 | tx_info = MWIFIEX_SKB_TXCB(skb); |
191 | memset(tx_info, 0, sizeof(*tx_info)); | ||
191 | tx_info->bss_num = priv->bss_num; | 192 | tx_info->bss_num = priv->bss_num; |
192 | tx_info->bss_type = priv->bss_type; | 193 | tx_info->bss_type = priv->bss_type; |
193 | tx_info->pkt_len = pkt_len; | 194 | tx_info->pkt_len = pkt_len; |
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c index df42f066d70c..5899eee87fb1 100644 --- a/drivers/net/wireless/mwifiex/cmdevt.c +++ b/drivers/net/wireless/mwifiex/cmdevt.c | |||
@@ -462,6 +462,7 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter) | |||
462 | 462 | ||
463 | if (skb) { | 463 | if (skb) { |
464 | rx_info = MWIFIEX_SKB_RXCB(skb); | 464 | rx_info = MWIFIEX_SKB_RXCB(skb); |
465 | memset(rx_info, 0, sizeof(*rx_info)); | ||
465 | rx_info->bss_num = priv->bss_num; | 466 | rx_info->bss_num = priv->bss_num; |
466 | rx_info->bss_type = priv->bss_type; | 467 | rx_info->bss_type = priv->bss_type; |
467 | } | 468 | } |
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index 657504c3c79d..3e5194fb0b0f 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c | |||
@@ -644,6 +644,7 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
644 | } | 644 | } |
645 | 645 | ||
646 | tx_info = MWIFIEX_SKB_TXCB(skb); | 646 | tx_info = MWIFIEX_SKB_TXCB(skb); |
647 | memset(tx_info, 0, sizeof(*tx_info)); | ||
647 | tx_info->bss_num = priv->bss_num; | 648 | tx_info->bss_num = priv->bss_num; |
648 | tx_info->bss_type = priv->bss_type; | 649 | tx_info->bss_type = priv->bss_type; |
649 | tx_info->pkt_len = skb->len; | 650 | tx_info->pkt_len = skb->len; |
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c index 3c224a793b82..5f7afffdd34e 100644 --- a/drivers/net/wireless/mwifiex/pcie.c +++ b/drivers/net/wireless/mwifiex/pcie.c | |||
@@ -57,7 +57,7 @@ mwifiex_map_pci_memory(struct mwifiex_adapter *adapter, struct sk_buff *skb, | |||
57 | return -1; | 57 | return -1; |
58 | } | 58 | } |
59 | mapping.len = size; | 59 | mapping.len = size; |
60 | memcpy(skb->cb, &mapping, sizeof(mapping)); | 60 | mwifiex_store_mapping(skb, &mapping); |
61 | return 0; | 61 | return 0; |
62 | } | 62 | } |
63 | 63 | ||
@@ -67,7 +67,7 @@ static void mwifiex_unmap_pci_memory(struct mwifiex_adapter *adapter, | |||
67 | struct pcie_service_card *card = adapter->card; | 67 | struct pcie_service_card *card = adapter->card; |
68 | struct mwifiex_dma_mapping mapping; | 68 | struct mwifiex_dma_mapping mapping; |
69 | 69 | ||
70 | MWIFIEX_SKB_PACB(skb, &mapping); | 70 | mwifiex_get_mapping(skb, &mapping); |
71 | pci_unmap_single(card->dev, mapping.addr, mapping.len, flags); | 71 | pci_unmap_single(card->dev, mapping.addr, mapping.len, flags); |
72 | } | 72 | } |
73 | 73 | ||
diff --git a/drivers/net/wireless/mwifiex/sta_tx.c b/drivers/net/wireless/mwifiex/sta_tx.c index cf330ba951cd..dab7b33c54be 100644 --- a/drivers/net/wireless/mwifiex/sta_tx.c +++ b/drivers/net/wireless/mwifiex/sta_tx.c | |||
@@ -150,6 +150,7 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags) | |||
150 | return -1; | 150 | return -1; |
151 | 151 | ||
152 | tx_info = MWIFIEX_SKB_TXCB(skb); | 152 | tx_info = MWIFIEX_SKB_TXCB(skb); |
153 | memset(tx_info, 0, sizeof(*tx_info)); | ||
153 | tx_info->bss_num = priv->bss_num; | 154 | tx_info->bss_num = priv->bss_num; |
154 | tx_info->bss_type = priv->bss_type; | 155 | tx_info->bss_type = priv->bss_type; |
155 | tx_info->pkt_len = data_len - (sizeof(struct txpd) + INTF_HEADER_LEN); | 156 | tx_info->pkt_len = data_len - (sizeof(struct txpd) + INTF_HEADER_LEN); |
diff --git a/drivers/net/wireless/mwifiex/tdls.c b/drivers/net/wireless/mwifiex/tdls.c index 3efbcbe7e891..a414161c6064 100644 --- a/drivers/net/wireless/mwifiex/tdls.c +++ b/drivers/net/wireless/mwifiex/tdls.c | |||
@@ -604,6 +604,7 @@ int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, const u8 *peer, | |||
604 | } | 604 | } |
605 | 605 | ||
606 | tx_info = MWIFIEX_SKB_TXCB(skb); | 606 | tx_info = MWIFIEX_SKB_TXCB(skb); |
607 | memset(tx_info, 0, sizeof(*tx_info)); | ||
607 | tx_info->bss_num = priv->bss_num; | 608 | tx_info->bss_num = priv->bss_num; |
608 | tx_info->bss_type = priv->bss_type; | 609 | tx_info->bss_type = priv->bss_type; |
609 | 610 | ||
@@ -757,6 +758,7 @@ int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, const u8 *peer, | |||
757 | skb->priority = MWIFIEX_PRIO_VI; | 758 | skb->priority = MWIFIEX_PRIO_VI; |
758 | 759 | ||
759 | tx_info = MWIFIEX_SKB_TXCB(skb); | 760 | tx_info = MWIFIEX_SKB_TXCB(skb); |
761 | memset(tx_info, 0, sizeof(*tx_info)); | ||
760 | tx_info->bss_num = priv->bss_num; | 762 | tx_info->bss_num = priv->bss_num; |
761 | tx_info->bss_type = priv->bss_type; | 763 | tx_info->bss_type = priv->bss_type; |
762 | tx_info->flags |= MWIFIEX_BUF_FLAG_TDLS_PKT; | 764 | tx_info->flags |= MWIFIEX_BUF_FLAG_TDLS_PKT; |
diff --git a/drivers/net/wireless/mwifiex/txrx.c b/drivers/net/wireless/mwifiex/txrx.c index 08205683f877..96a2126cc44b 100644 --- a/drivers/net/wireless/mwifiex/txrx.c +++ b/drivers/net/wireless/mwifiex/txrx.c | |||
@@ -55,6 +55,7 @@ int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter, | |||
55 | return -1; | 55 | return -1; |
56 | } | 56 | } |
57 | 57 | ||
58 | memset(rx_info, 0, sizeof(*rx_info)); | ||
58 | rx_info->bss_num = priv->bss_num; | 59 | rx_info->bss_num = priv->bss_num; |
59 | rx_info->bss_type = priv->bss_type; | 60 | rx_info->bss_type = priv->bss_type; |
60 | 61 | ||
diff --git a/drivers/net/wireless/mwifiex/uap_txrx.c b/drivers/net/wireless/mwifiex/uap_txrx.c index ddfc3c6c1e78..ec7309d096ab 100644 --- a/drivers/net/wireless/mwifiex/uap_txrx.c +++ b/drivers/net/wireless/mwifiex/uap_txrx.c | |||
@@ -174,6 +174,7 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv, | |||
174 | } | 174 | } |
175 | 175 | ||
176 | tx_info = MWIFIEX_SKB_TXCB(skb); | 176 | tx_info = MWIFIEX_SKB_TXCB(skb); |
177 | memset(tx_info, 0, sizeof(*tx_info)); | ||
177 | tx_info->bss_num = priv->bss_num; | 178 | tx_info->bss_num = priv->bss_num; |
178 | tx_info->bss_type = priv->bss_type; | 179 | tx_info->bss_type = priv->bss_type; |
179 | tx_info->flags |= MWIFIEX_BUF_FLAG_BRIDGED_PKT; | 180 | tx_info->flags |= MWIFIEX_BUF_FLAG_BRIDGED_PKT; |
diff --git a/drivers/net/wireless/mwifiex/util.h b/drivers/net/wireless/mwifiex/util.h index 9a31215487dd..40296cb4a3f1 100644 --- a/drivers/net/wireless/mwifiex/util.h +++ b/drivers/net/wireless/mwifiex/util.h | |||
@@ -20,32 +20,55 @@ | |||
20 | #ifndef _MWIFIEX_UTIL_H_ | 20 | #ifndef _MWIFIEX_UTIL_H_ |
21 | #define _MWIFIEX_UTIL_H_ | 21 | #define _MWIFIEX_UTIL_H_ |
22 | 22 | ||
23 | struct mwifiex_dma_mapping { | ||
24 | dma_addr_t addr; | ||
25 | size_t len; | ||
26 | }; | ||
27 | |||
28 | struct mwifiex_cb { | ||
29 | struct mwifiex_dma_mapping dma_mapping; | ||
30 | union { | ||
31 | struct mwifiex_rxinfo rx_info; | ||
32 | struct mwifiex_txinfo tx_info; | ||
33 | }; | ||
34 | }; | ||
35 | |||
23 | static inline struct mwifiex_rxinfo *MWIFIEX_SKB_RXCB(struct sk_buff *skb) | 36 | static inline struct mwifiex_rxinfo *MWIFIEX_SKB_RXCB(struct sk_buff *skb) |
24 | { | 37 | { |
25 | return (struct mwifiex_rxinfo *)(skb->cb + sizeof(dma_addr_t)); | 38 | struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb; |
39 | |||
40 | BUILD_BUG_ON(sizeof(struct mwifiex_cb) > sizeof(skb->cb)); | ||
41 | return &cb->rx_info; | ||
26 | } | 42 | } |
27 | 43 | ||
28 | static inline struct mwifiex_txinfo *MWIFIEX_SKB_TXCB(struct sk_buff *skb) | 44 | static inline struct mwifiex_txinfo *MWIFIEX_SKB_TXCB(struct sk_buff *skb) |
29 | { | 45 | { |
30 | return (struct mwifiex_txinfo *)(skb->cb + sizeof(dma_addr_t)); | 46 | struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb; |
47 | |||
48 | return &cb->tx_info; | ||
31 | } | 49 | } |
32 | 50 | ||
33 | struct mwifiex_dma_mapping { | 51 | static inline void mwifiex_store_mapping(struct sk_buff *skb, |
34 | dma_addr_t addr; | 52 | struct mwifiex_dma_mapping *mapping) |
35 | size_t len; | 53 | { |
36 | }; | 54 | struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb; |
55 | |||
56 | memcpy(&cb->dma_mapping, mapping, sizeof(*mapping)); | ||
57 | } | ||
37 | 58 | ||
38 | static inline void MWIFIEX_SKB_PACB(struct sk_buff *skb, | 59 | static inline void mwifiex_get_mapping(struct sk_buff *skb, |
39 | struct mwifiex_dma_mapping *mapping) | 60 | struct mwifiex_dma_mapping *mapping) |
40 | { | 61 | { |
41 | memcpy(mapping, skb->cb, sizeof(*mapping)); | 62 | struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb; |
63 | |||
64 | memcpy(mapping, &cb->dma_mapping, sizeof(*mapping)); | ||
42 | } | 65 | } |
43 | 66 | ||
44 | static inline dma_addr_t MWIFIEX_SKB_DMA_ADDR(struct sk_buff *skb) | 67 | static inline dma_addr_t MWIFIEX_SKB_DMA_ADDR(struct sk_buff *skb) |
45 | { | 68 | { |
46 | struct mwifiex_dma_mapping mapping; | 69 | struct mwifiex_dma_mapping mapping; |
47 | 70 | ||
48 | MWIFIEX_SKB_PACB(skb, &mapping); | 71 | mwifiex_get_mapping(skb, &mapping); |
49 | 72 | ||
50 | return mapping.addr; | 73 | return mapping.addr; |
51 | } | 74 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 2f1cd929c6f6..a511cccc9f01 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -1681,8 +1681,13 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1681 | /* | 1681 | /* |
1682 | * Detect if this device has an hardware controlled radio. | 1682 | * Detect if this device has an hardware controlled radio. |
1683 | */ | 1683 | */ |
1684 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) | 1684 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) { |
1685 | __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags); | 1685 | __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags); |
1686 | /* | ||
1687 | * On this device RFKILL initialized during probe does not work. | ||
1688 | */ | ||
1689 | __set_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags); | ||
1690 | } | ||
1686 | 1691 | ||
1687 | /* | 1692 | /* |
1688 | * Check if the BBP tuning should be enabled. | 1693 | * Check if the BBP tuning should be enabled. |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index a49c3d73ea2c..832006b5aab1 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -229,6 +229,31 @@ static enum hrtimer_restart rt2800usb_tx_sta_fifo_timeout(struct hrtimer *timer) | |||
229 | /* | 229 | /* |
230 | * Firmware functions | 230 | * Firmware functions |
231 | */ | 231 | */ |
232 | static int rt2800usb_autorun_detect(struct rt2x00_dev *rt2x00dev) | ||
233 | { | ||
234 | __le32 *reg; | ||
235 | u32 fw_mode; | ||
236 | |||
237 | reg = kmalloc(sizeof(*reg), GFP_KERNEL); | ||
238 | if (reg == NULL) | ||
239 | return -ENOMEM; | ||
240 | /* cannot use rt2x00usb_register_read here as it uses different | ||
241 | * mode (MULTI_READ vs. DEVICE_MODE) and does not pass the | ||
242 | * magic value USB_MODE_AUTORUN (0x11) to the device, thus the | ||
243 | * returned value would be invalid. | ||
244 | */ | ||
245 | rt2x00usb_vendor_request(rt2x00dev, USB_DEVICE_MODE, | ||
246 | USB_VENDOR_REQUEST_IN, 0, USB_MODE_AUTORUN, | ||
247 | reg, sizeof(*reg), REGISTER_TIMEOUT_FIRMWARE); | ||
248 | fw_mode = le32_to_cpu(*reg); | ||
249 | kfree(reg); | ||
250 | |||
251 | if ((fw_mode & 0x00000003) == 2) | ||
252 | return 1; | ||
253 | |||
254 | return 0; | ||
255 | } | ||
256 | |||
232 | static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) | 257 | static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) |
233 | { | 258 | { |
234 | return FIRMWARE_RT2870; | 259 | return FIRMWARE_RT2870; |
@@ -240,6 +265,7 @@ static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev, | |||
240 | int status; | 265 | int status; |
241 | u32 offset; | 266 | u32 offset; |
242 | u32 length; | 267 | u32 length; |
268 | int retval; | ||
243 | 269 | ||
244 | /* | 270 | /* |
245 | * Check which section of the firmware we need. | 271 | * Check which section of the firmware we need. |
@@ -257,8 +283,16 @@ static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev, | |||
257 | /* | 283 | /* |
258 | * Write firmware to device. | 284 | * Write firmware to device. |
259 | */ | 285 | */ |
260 | rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, | 286 | retval = rt2800usb_autorun_detect(rt2x00dev); |
261 | data + offset, length); | 287 | if (retval < 0) |
288 | return retval; | ||
289 | if (retval) { | ||
290 | rt2x00_info(rt2x00dev, | ||
291 | "Firmware loading not required - NIC in AutoRun mode\n"); | ||
292 | } else { | ||
293 | rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, | ||
294 | data + offset, length); | ||
295 | } | ||
262 | 296 | ||
263 | rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); | 297 | rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); |
264 | rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); | 298 | rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); |
@@ -735,11 +769,26 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry, | |||
735 | /* | 769 | /* |
736 | * Device probe functions. | 770 | * Device probe functions. |
737 | */ | 771 | */ |
772 | static int rt2800usb_efuse_detect(struct rt2x00_dev *rt2x00dev) | ||
773 | { | ||
774 | int retval; | ||
775 | |||
776 | retval = rt2800usb_autorun_detect(rt2x00dev); | ||
777 | if (retval < 0) | ||
778 | return retval; | ||
779 | if (retval) | ||
780 | return 1; | ||
781 | return rt2800_efuse_detect(rt2x00dev); | ||
782 | } | ||
783 | |||
738 | static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev) | 784 | static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev) |
739 | { | 785 | { |
740 | int retval; | 786 | int retval; |
741 | 787 | ||
742 | if (rt2800_efuse_detect(rt2x00dev)) | 788 | retval = rt2800usb_efuse_detect(rt2x00dev); |
789 | if (retval < 0) | ||
790 | return retval; | ||
791 | if (retval) | ||
743 | retval = rt2800_read_eeprom_efuse(rt2x00dev); | 792 | retval = rt2800_read_eeprom_efuse(rt2x00dev); |
744 | else | 793 | else |
745 | retval = rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, | 794 | retval = rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 010b76505243..d13f25cd70d5 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -693,6 +693,7 @@ enum rt2x00_capability_flags { | |||
693 | REQUIRE_SW_SEQNO, | 693 | REQUIRE_SW_SEQNO, |
694 | REQUIRE_HT_TX_DESC, | 694 | REQUIRE_HT_TX_DESC, |
695 | REQUIRE_PS_AUTOWAKE, | 695 | REQUIRE_PS_AUTOWAKE, |
696 | REQUIRE_DELAYED_RFKILL, | ||
696 | 697 | ||
697 | /* | 698 | /* |
698 | * Capabilities | 699 | * Capabilities |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index c6ae9a495b77..9967a1d9f0ec 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -1129,9 +1129,10 @@ static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev) | |||
1129 | return; | 1129 | return; |
1130 | 1130 | ||
1131 | /* | 1131 | /* |
1132 | * Unregister extra components. | 1132 | * Stop rfkill polling. |
1133 | */ | 1133 | */ |
1134 | rt2x00rfkill_unregister(rt2x00dev); | 1134 | if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) |
1135 | rt2x00rfkill_unregister(rt2x00dev); | ||
1135 | 1136 | ||
1136 | /* | 1137 | /* |
1137 | * Allow the HW to uninitialize. | 1138 | * Allow the HW to uninitialize. |
@@ -1169,6 +1170,12 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev) | |||
1169 | 1170 | ||
1170 | set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); | 1171 | set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); |
1171 | 1172 | ||
1173 | /* | ||
1174 | * Start rfkill polling. | ||
1175 | */ | ||
1176 | if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) | ||
1177 | rt2x00rfkill_register(rt2x00dev); | ||
1178 | |||
1172 | return 0; | 1179 | return 0; |
1173 | } | 1180 | } |
1174 | 1181 | ||
@@ -1378,7 +1385,12 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) | |||
1378 | rt2x00link_register(rt2x00dev); | 1385 | rt2x00link_register(rt2x00dev); |
1379 | rt2x00leds_register(rt2x00dev); | 1386 | rt2x00leds_register(rt2x00dev); |
1380 | rt2x00debug_register(rt2x00dev); | 1387 | rt2x00debug_register(rt2x00dev); |
1381 | rt2x00rfkill_register(rt2x00dev); | 1388 | |
1389 | /* | ||
1390 | * Start rfkill polling. | ||
1391 | */ | ||
1392 | if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) | ||
1393 | rt2x00rfkill_register(rt2x00dev); | ||
1382 | 1394 | ||
1383 | return 0; | 1395 | return 0; |
1384 | 1396 | ||
@@ -1394,6 +1406,12 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) | |||
1394 | clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); | 1406 | clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); |
1395 | 1407 | ||
1396 | /* | 1408 | /* |
1409 | * Stop rfkill polling. | ||
1410 | */ | ||
1411 | if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) | ||
1412 | rt2x00rfkill_unregister(rt2x00dev); | ||
1413 | |||
1414 | /* | ||
1397 | * Disable radio. | 1415 | * Disable radio. |
1398 | */ | 1416 | */ |
1399 | rt2x00lib_disable_radio(rt2x00dev); | 1417 | rt2x00lib_disable_radio(rt2x00dev); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index e5935ea3719f..ad6e5a8d1e10 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
@@ -487,6 +487,8 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
487 | crypto.cipher = rt2x00crypto_key_to_cipher(key); | 487 | crypto.cipher = rt2x00crypto_key_to_cipher(key); |
488 | if (crypto.cipher == CIPHER_NONE) | 488 | if (crypto.cipher == CIPHER_NONE) |
489 | return -EOPNOTSUPP; | 489 | return -EOPNOTSUPP; |
490 | if (crypto.cipher == CIPHER_TKIP && rt2x00_is_usb(rt2x00dev)) | ||
491 | return -EOPNOTSUPP; | ||
490 | 492 | ||
491 | crypto.cmd = cmd; | 493 | crypto.cmd = cmd; |
492 | 494 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h index e7bcf62347d5..831b65f93feb 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.h +++ b/drivers/net/wireless/rt2x00/rt2x00usb.h | |||
@@ -93,6 +93,7 @@ enum rt2x00usb_mode_offset { | |||
93 | USB_MODE_SLEEP = 7, /* RT73USB */ | 93 | USB_MODE_SLEEP = 7, /* RT73USB */ |
94 | USB_MODE_FIRMWARE = 8, /* RT73USB */ | 94 | USB_MODE_FIRMWARE = 8, /* RT73USB */ |
95 | USB_MODE_WAKEUP = 9, /* RT73USB */ | 95 | USB_MODE_WAKEUP = 9, /* RT73USB */ |
96 | USB_MODE_AUTORUN = 17, /* RT2800USB */ | ||
96 | }; | 97 | }; |
97 | 98 | ||
98 | /** | 99 | /** |
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 8671bc79a35b..a7a27bc2c0b1 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -289,10 +289,20 @@ static void hci_conn_timeout(struct work_struct *work) | |||
289 | { | 289 | { |
290 | struct hci_conn *conn = container_of(work, struct hci_conn, | 290 | struct hci_conn *conn = container_of(work, struct hci_conn, |
291 | disc_work.work); | 291 | disc_work.work); |
292 | int refcnt = atomic_read(&conn->refcnt); | ||
292 | 293 | ||
293 | BT_DBG("hcon %p state %s", conn, state_to_string(conn->state)); | 294 | BT_DBG("hcon %p state %s", conn, state_to_string(conn->state)); |
294 | 295 | ||
295 | if (atomic_read(&conn->refcnt)) | 296 | WARN_ON(refcnt < 0); |
297 | |||
298 | /* FIXME: It was observed that in pairing failed scenario, refcnt | ||
299 | * drops below 0. Probably this is because l2cap_conn_del calls | ||
300 | * l2cap_chan_del for each channel, and inside l2cap_chan_del conn is | ||
301 | * dropped. After that loop hci_chan_del is called which also drops | ||
302 | * conn. For now make sure that ACL is alive if refcnt is higher then 0, | ||
303 | * otherwise drop it. | ||
304 | */ | ||
305 | if (refcnt > 0) | ||
296 | return; | 306 | return; |
297 | 307 | ||
298 | switch (conn->state) { | 308 | switch (conn->state) { |
@@ -610,11 +620,6 @@ static void hci_req_add_le_create_conn(struct hci_request *req, | |||
610 | if (hci_update_random_address(req, false, &own_addr_type)) | 620 | if (hci_update_random_address(req, false, &own_addr_type)) |
611 | return; | 621 | return; |
612 | 622 | ||
613 | /* Save the address type used for this connnection attempt so we able | ||
614 | * to retrieve this information if we need it. | ||
615 | */ | ||
616 | conn->src_type = own_addr_type; | ||
617 | |||
618 | cp.scan_interval = cpu_to_le16(hdev->le_scan_interval); | 623 | cp.scan_interval = cpu_to_le16(hdev->le_scan_interval); |
619 | cp.scan_window = cpu_to_le16(hdev->le_scan_window); | 624 | cp.scan_window = cpu_to_le16(hdev->le_scan_window); |
620 | bacpy(&cp.peer_addr, &conn->dst); | 625 | bacpy(&cp.peer_addr, &conn->dst); |
@@ -894,7 +899,7 @@ static int hci_conn_auth(struct hci_conn *conn, __u8 sec_level, __u8 auth_type) | |||
894 | /* If we're already encrypted set the REAUTH_PEND flag, | 899 | /* If we're already encrypted set the REAUTH_PEND flag, |
895 | * otherwise set the ENCRYPT_PEND. | 900 | * otherwise set the ENCRYPT_PEND. |
896 | */ | 901 | */ |
897 | if (conn->key_type != 0xff) | 902 | if (conn->link_mode & HCI_LM_ENCRYPT) |
898 | set_bit(HCI_CONN_REAUTH_PEND, &conn->flags); | 903 | set_bit(HCI_CONN_REAUTH_PEND, &conn->flags); |
899 | else | 904 | else |
900 | set_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); | 905 | set_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 21e5913d12e0..640c54ec1bd2 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -48,6 +48,10 @@ static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb) | |||
48 | smp_mb__after_atomic(); /* wake_up_bit advises about this barrier */ | 48 | smp_mb__after_atomic(); /* wake_up_bit advises about this barrier */ |
49 | wake_up_bit(&hdev->flags, HCI_INQUIRY); | 49 | wake_up_bit(&hdev->flags, HCI_INQUIRY); |
50 | 50 | ||
51 | hci_dev_lock(hdev); | ||
52 | hci_discovery_set_state(hdev, DISCOVERY_STOPPED); | ||
53 | hci_dev_unlock(hdev); | ||
54 | |||
51 | hci_conn_check_pending(hdev); | 55 | hci_conn_check_pending(hdev); |
52 | } | 56 | } |
53 | 57 | ||
@@ -3537,7 +3541,11 @@ static void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
3537 | cp.authentication = conn->auth_type; | 3541 | cp.authentication = conn->auth_type; |
3538 | 3542 | ||
3539 | /* Request MITM protection if our IO caps allow it | 3543 | /* Request MITM protection if our IO caps allow it |
3540 | * except for the no-bonding case | 3544 | * except for the no-bonding case. |
3545 | * conn->auth_type is not updated here since | ||
3546 | * that might cause the user confirmation to be | ||
3547 | * rejected in case the remote doesn't have the | ||
3548 | * IO capabilities for MITM. | ||
3541 | */ | 3549 | */ |
3542 | if (conn->io_capability != HCI_IO_NO_INPUT_OUTPUT && | 3550 | if (conn->io_capability != HCI_IO_NO_INPUT_OUTPUT && |
3543 | cp.authentication != HCI_AT_NO_BONDING) | 3551 | cp.authentication != HCI_AT_NO_BONDING) |
@@ -3628,8 +3636,11 @@ static void hci_user_confirm_request_evt(struct hci_dev *hdev, | |||
3628 | 3636 | ||
3629 | /* If we're not the initiators request authorization to | 3637 | /* If we're not the initiators request authorization to |
3630 | * proceed from user space (mgmt_user_confirm with | 3638 | * proceed from user space (mgmt_user_confirm with |
3631 | * confirm_hint set to 1). */ | 3639 | * confirm_hint set to 1). The exception is if neither |
3632 | if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags)) { | 3640 | * side had MITM in which case we do auto-accept. |
3641 | */ | ||
3642 | if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags) && | ||
3643 | (loc_mitm || rem_mitm)) { | ||
3633 | BT_DBG("Confirming auto-accept as acceptor"); | 3644 | BT_DBG("Confirming auto-accept as acceptor"); |
3634 | confirm_hint = 1; | 3645 | confirm_hint = 1; |
3635 | goto confirm; | 3646 | goto confirm; |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 6eabbe05fe54..323f23cd2c37 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -1663,7 +1663,13 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err) | |||
1663 | kfree_skb(conn->rx_skb); | 1663 | kfree_skb(conn->rx_skb); |
1664 | 1664 | ||
1665 | skb_queue_purge(&conn->pending_rx); | 1665 | skb_queue_purge(&conn->pending_rx); |
1666 | flush_work(&conn->pending_rx_work); | 1666 | |
1667 | /* We can not call flush_work(&conn->pending_rx_work) here since we | ||
1668 | * might block if we are running on a worker from the same workqueue | ||
1669 | * pending_rx_work is waiting on. | ||
1670 | */ | ||
1671 | if (work_pending(&conn->pending_rx_work)) | ||
1672 | cancel_work_sync(&conn->pending_rx_work); | ||
1667 | 1673 | ||
1668 | l2cap_unregister_all_users(conn); | 1674 | l2cap_unregister_all_users(conn); |
1669 | 1675 | ||
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index ade3fb4c23bc..e1378693cc90 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c | |||
@@ -787,11 +787,6 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, | |||
787 | 787 | ||
788 | /*change security for LE channels */ | 788 | /*change security for LE channels */ |
789 | if (chan->scid == L2CAP_CID_ATT) { | 789 | if (chan->scid == L2CAP_CID_ATT) { |
790 | if (!conn->hcon->out) { | ||
791 | err = -EINVAL; | ||
792 | break; | ||
793 | } | ||
794 | |||
795 | if (smp_conn_security(conn->hcon, sec.level)) | 790 | if (smp_conn_security(conn->hcon, sec.level)) |
796 | break; | 791 | break; |
797 | sk->sk_state = BT_CONFIG; | 792 | sk->sk_state = BT_CONFIG; |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 0fce54412ffd..af8e0a6243b7 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -1047,6 +1047,43 @@ static void clean_up_hci_complete(struct hci_dev *hdev, u8 status) | |||
1047 | } | 1047 | } |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | static void hci_stop_discovery(struct hci_request *req) | ||
1051 | { | ||
1052 | struct hci_dev *hdev = req->hdev; | ||
1053 | struct hci_cp_remote_name_req_cancel cp; | ||
1054 | struct inquiry_entry *e; | ||
1055 | |||
1056 | switch (hdev->discovery.state) { | ||
1057 | case DISCOVERY_FINDING: | ||
1058 | if (test_bit(HCI_INQUIRY, &hdev->flags)) { | ||
1059 | hci_req_add(req, HCI_OP_INQUIRY_CANCEL, 0, NULL); | ||
1060 | } else { | ||
1061 | cancel_delayed_work(&hdev->le_scan_disable); | ||
1062 | hci_req_add_le_scan_disable(req); | ||
1063 | } | ||
1064 | |||
1065 | break; | ||
1066 | |||
1067 | case DISCOVERY_RESOLVING: | ||
1068 | e = hci_inquiry_cache_lookup_resolve(hdev, BDADDR_ANY, | ||
1069 | NAME_PENDING); | ||
1070 | if (!e) | ||
1071 | return; | ||
1072 | |||
1073 | bacpy(&cp.bdaddr, &e->data.bdaddr); | ||
1074 | hci_req_add(req, HCI_OP_REMOTE_NAME_REQ_CANCEL, sizeof(cp), | ||
1075 | &cp); | ||
1076 | |||
1077 | break; | ||
1078 | |||
1079 | default: | ||
1080 | /* Passive scanning */ | ||
1081 | if (test_bit(HCI_LE_SCAN, &hdev->dev_flags)) | ||
1082 | hci_req_add_le_scan_disable(req); | ||
1083 | break; | ||
1084 | } | ||
1085 | } | ||
1086 | |||
1050 | static int clean_up_hci_state(struct hci_dev *hdev) | 1087 | static int clean_up_hci_state(struct hci_dev *hdev) |
1051 | { | 1088 | { |
1052 | struct hci_request req; | 1089 | struct hci_request req; |
@@ -1063,9 +1100,7 @@ static int clean_up_hci_state(struct hci_dev *hdev) | |||
1063 | if (test_bit(HCI_ADVERTISING, &hdev->dev_flags)) | 1100 | if (test_bit(HCI_ADVERTISING, &hdev->dev_flags)) |
1064 | disable_advertising(&req); | 1101 | disable_advertising(&req); |
1065 | 1102 | ||
1066 | if (test_bit(HCI_LE_SCAN, &hdev->dev_flags)) { | 1103 | hci_stop_discovery(&req); |
1067 | hci_req_add_le_scan_disable(&req); | ||
1068 | } | ||
1069 | 1104 | ||
1070 | list_for_each_entry(conn, &hdev->conn_hash.list, list) { | 1105 | list_for_each_entry(conn, &hdev->conn_hash.list, list) { |
1071 | struct hci_cp_disconnect dc; | 1106 | struct hci_cp_disconnect dc; |
@@ -2996,8 +3031,13 @@ static int user_pairing_resp(struct sock *sk, struct hci_dev *hdev, | |||
2996 | } | 3031 | } |
2997 | 3032 | ||
2998 | if (addr->type == BDADDR_LE_PUBLIC || addr->type == BDADDR_LE_RANDOM) { | 3033 | if (addr->type == BDADDR_LE_PUBLIC || addr->type == BDADDR_LE_RANDOM) { |
2999 | /* Continue with pairing via SMP */ | 3034 | /* Continue with pairing via SMP. The hdev lock must be |
3035 | * released as SMP may try to recquire it for crypto | ||
3036 | * purposes. | ||
3037 | */ | ||
3038 | hci_dev_unlock(hdev); | ||
3000 | err = smp_user_confirm_reply(conn, mgmt_op, passkey); | 3039 | err = smp_user_confirm_reply(conn, mgmt_op, passkey); |
3040 | hci_dev_lock(hdev); | ||
3001 | 3041 | ||
3002 | if (!err) | 3042 | if (!err) |
3003 | err = cmd_complete(sk, hdev->id, mgmt_op, | 3043 | err = cmd_complete(sk, hdev->id, mgmt_op, |
@@ -3574,8 +3614,6 @@ static int stop_discovery(struct sock *sk, struct hci_dev *hdev, void *data, | |||
3574 | { | 3614 | { |
3575 | struct mgmt_cp_stop_discovery *mgmt_cp = data; | 3615 | struct mgmt_cp_stop_discovery *mgmt_cp = data; |
3576 | struct pending_cmd *cmd; | 3616 | struct pending_cmd *cmd; |
3577 | struct hci_cp_remote_name_req_cancel cp; | ||
3578 | struct inquiry_entry *e; | ||
3579 | struct hci_request req; | 3617 | struct hci_request req; |
3580 | int err; | 3618 | int err; |
3581 | 3619 | ||
@@ -3605,52 +3643,22 @@ static int stop_discovery(struct sock *sk, struct hci_dev *hdev, void *data, | |||
3605 | 3643 | ||
3606 | hci_req_init(&req, hdev); | 3644 | hci_req_init(&req, hdev); |
3607 | 3645 | ||
3608 | switch (hdev->discovery.state) { | 3646 | hci_stop_discovery(&req); |
3609 | case DISCOVERY_FINDING: | ||
3610 | if (test_bit(HCI_INQUIRY, &hdev->flags)) { | ||
3611 | hci_req_add(&req, HCI_OP_INQUIRY_CANCEL, 0, NULL); | ||
3612 | } else { | ||
3613 | cancel_delayed_work(&hdev->le_scan_disable); | ||
3614 | |||
3615 | hci_req_add_le_scan_disable(&req); | ||
3616 | } | ||
3617 | |||
3618 | break; | ||
3619 | 3647 | ||
3620 | case DISCOVERY_RESOLVING: | 3648 | err = hci_req_run(&req, stop_discovery_complete); |
3621 | e = hci_inquiry_cache_lookup_resolve(hdev, BDADDR_ANY, | 3649 | if (!err) { |
3622 | NAME_PENDING); | 3650 | hci_discovery_set_state(hdev, DISCOVERY_STOPPING); |
3623 | if (!e) { | ||
3624 | mgmt_pending_remove(cmd); | ||
3625 | err = cmd_complete(sk, hdev->id, | ||
3626 | MGMT_OP_STOP_DISCOVERY, 0, | ||
3627 | &mgmt_cp->type, | ||
3628 | sizeof(mgmt_cp->type)); | ||
3629 | hci_discovery_set_state(hdev, DISCOVERY_STOPPED); | ||
3630 | goto unlock; | ||
3631 | } | ||
3632 | |||
3633 | bacpy(&cp.bdaddr, &e->data.bdaddr); | ||
3634 | hci_req_add(&req, HCI_OP_REMOTE_NAME_REQ_CANCEL, sizeof(cp), | ||
3635 | &cp); | ||
3636 | |||
3637 | break; | ||
3638 | |||
3639 | default: | ||
3640 | BT_DBG("unknown discovery state %u", hdev->discovery.state); | ||
3641 | |||
3642 | mgmt_pending_remove(cmd); | ||
3643 | err = cmd_complete(sk, hdev->id, MGMT_OP_STOP_DISCOVERY, | ||
3644 | MGMT_STATUS_FAILED, &mgmt_cp->type, | ||
3645 | sizeof(mgmt_cp->type)); | ||
3646 | goto unlock; | 3651 | goto unlock; |
3647 | } | 3652 | } |
3648 | 3653 | ||
3649 | err = hci_req_run(&req, stop_discovery_complete); | 3654 | mgmt_pending_remove(cmd); |
3650 | if (err < 0) | 3655 | |
3651 | mgmt_pending_remove(cmd); | 3656 | /* If no HCI commands were sent we're done */ |
3652 | else | 3657 | if (err == -ENODATA) { |
3653 | hci_discovery_set_state(hdev, DISCOVERY_STOPPING); | 3658 | err = cmd_complete(sk, hdev->id, MGMT_OP_STOP_DISCOVERY, 0, |
3659 | &mgmt_cp->type, sizeof(mgmt_cp->type)); | ||
3660 | hci_discovery_set_state(hdev, DISCOVERY_STOPPED); | ||
3661 | } | ||
3654 | 3662 | ||
3655 | unlock: | 3663 | unlock: |
3656 | hci_dev_unlock(hdev); | 3664 | hci_dev_unlock(hdev); |
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 3d1cc164557d..e33a982161c1 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -385,6 +385,16 @@ static const u8 gen_method[5][5] = { | |||
385 | { CFM_PASSKEY, CFM_PASSKEY, REQ_PASSKEY, JUST_WORKS, OVERLAP }, | 385 | { CFM_PASSKEY, CFM_PASSKEY, REQ_PASSKEY, JUST_WORKS, OVERLAP }, |
386 | }; | 386 | }; |
387 | 387 | ||
388 | static u8 get_auth_method(struct smp_chan *smp, u8 local_io, u8 remote_io) | ||
389 | { | ||
390 | /* If either side has unknown io_caps, use JUST WORKS */ | ||
391 | if (local_io > SMP_IO_KEYBOARD_DISPLAY || | ||
392 | remote_io > SMP_IO_KEYBOARD_DISPLAY) | ||
393 | return JUST_WORKS; | ||
394 | |||
395 | return gen_method[remote_io][local_io]; | ||
396 | } | ||
397 | |||
388 | static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth, | 398 | static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth, |
389 | u8 local_io, u8 remote_io) | 399 | u8 local_io, u8 remote_io) |
390 | { | 400 | { |
@@ -401,14 +411,11 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth, | |||
401 | BT_DBG("tk_request: auth:%d lcl:%d rem:%d", auth, local_io, remote_io); | 411 | BT_DBG("tk_request: auth:%d lcl:%d rem:%d", auth, local_io, remote_io); |
402 | 412 | ||
403 | /* If neither side wants MITM, use JUST WORKS */ | 413 | /* If neither side wants MITM, use JUST WORKS */ |
404 | /* If either side has unknown io_caps, use JUST WORKS */ | ||
405 | /* Otherwise, look up method from the table */ | 414 | /* Otherwise, look up method from the table */ |
406 | if (!(auth & SMP_AUTH_MITM) || | 415 | if (!(auth & SMP_AUTH_MITM)) |
407 | local_io > SMP_IO_KEYBOARD_DISPLAY || | ||
408 | remote_io > SMP_IO_KEYBOARD_DISPLAY) | ||
409 | method = JUST_WORKS; | 416 | method = JUST_WORKS; |
410 | else | 417 | else |
411 | method = gen_method[remote_io][local_io]; | 418 | method = get_auth_method(smp, local_io, remote_io); |
412 | 419 | ||
413 | /* If not bonding, don't ask user to confirm a Zero TK */ | 420 | /* If not bonding, don't ask user to confirm a Zero TK */ |
414 | if (!(auth & SMP_AUTH_BONDING) && method == JUST_CFM) | 421 | if (!(auth & SMP_AUTH_BONDING) && method == JUST_CFM) |
@@ -544,7 +551,7 @@ static u8 smp_random(struct smp_chan *smp) | |||
544 | hci_le_start_enc(hcon, ediv, rand, stk); | 551 | hci_le_start_enc(hcon, ediv, rand, stk); |
545 | hcon->enc_key_size = smp->enc_key_size; | 552 | hcon->enc_key_size = smp->enc_key_size; |
546 | } else { | 553 | } else { |
547 | u8 stk[16]; | 554 | u8 stk[16], auth; |
548 | __le64 rand = 0; | 555 | __le64 rand = 0; |
549 | __le16 ediv = 0; | 556 | __le16 ediv = 0; |
550 | 557 | ||
@@ -556,8 +563,13 @@ static u8 smp_random(struct smp_chan *smp) | |||
556 | memset(stk + smp->enc_key_size, 0, | 563 | memset(stk + smp->enc_key_size, 0, |
557 | SMP_MAX_ENC_KEY_SIZE - smp->enc_key_size); | 564 | SMP_MAX_ENC_KEY_SIZE - smp->enc_key_size); |
558 | 565 | ||
566 | if (hcon->pending_sec_level == BT_SECURITY_HIGH) | ||
567 | auth = 1; | ||
568 | else | ||
569 | auth = 0; | ||
570 | |||
559 | hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, | 571 | hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, |
560 | HCI_SMP_STK_SLAVE, 0, stk, smp->enc_key_size, | 572 | HCI_SMP_STK_SLAVE, auth, stk, smp->enc_key_size, |
561 | ediv, rand); | 573 | ediv, rand); |
562 | } | 574 | } |
563 | 575 | ||
@@ -664,7 +676,7 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
664 | { | 676 | { |
665 | struct smp_cmd_pairing rsp, *req = (void *) skb->data; | 677 | struct smp_cmd_pairing rsp, *req = (void *) skb->data; |
666 | struct smp_chan *smp; | 678 | struct smp_chan *smp; |
667 | u8 key_size, auth; | 679 | u8 key_size, auth, sec_level; |
668 | int ret; | 680 | int ret; |
669 | 681 | ||
670 | BT_DBG("conn %p", conn); | 682 | BT_DBG("conn %p", conn); |
@@ -690,7 +702,19 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
690 | /* We didn't start the pairing, so match remote */ | 702 | /* We didn't start the pairing, so match remote */ |
691 | auth = req->auth_req; | 703 | auth = req->auth_req; |
692 | 704 | ||
693 | conn->hcon->pending_sec_level = authreq_to_seclevel(auth); | 705 | sec_level = authreq_to_seclevel(auth); |
706 | if (sec_level > conn->hcon->pending_sec_level) | ||
707 | conn->hcon->pending_sec_level = sec_level; | ||
708 | |||
709 | /* If we need MITM check that it can be acheived */ | ||
710 | if (conn->hcon->pending_sec_level >= BT_SECURITY_HIGH) { | ||
711 | u8 method; | ||
712 | |||
713 | method = get_auth_method(smp, conn->hcon->io_capability, | ||
714 | req->io_capability); | ||
715 | if (method == JUST_WORKS || method == JUST_CFM) | ||
716 | return SMP_AUTH_REQUIREMENTS; | ||
717 | } | ||
694 | 718 | ||
695 | build_pairing_cmd(conn, req, &rsp, auth); | 719 | build_pairing_cmd(conn, req, &rsp, auth); |
696 | 720 | ||
@@ -738,6 +762,16 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb) | |||
738 | if (check_enc_key_size(conn, key_size)) | 762 | if (check_enc_key_size(conn, key_size)) |
739 | return SMP_ENC_KEY_SIZE; | 763 | return SMP_ENC_KEY_SIZE; |
740 | 764 | ||
765 | /* If we need MITM check that it can be acheived */ | ||
766 | if (conn->hcon->pending_sec_level >= BT_SECURITY_HIGH) { | ||
767 | u8 method; | ||
768 | |||
769 | method = get_auth_method(smp, req->io_capability, | ||
770 | rsp->io_capability); | ||
771 | if (method == JUST_WORKS || method == JUST_CFM) | ||
772 | return SMP_AUTH_REQUIREMENTS; | ||
773 | } | ||
774 | |||
741 | get_random_bytes(smp->prnd, sizeof(smp->prnd)); | 775 | get_random_bytes(smp->prnd, sizeof(smp->prnd)); |
742 | 776 | ||
743 | smp->prsp[0] = SMP_CMD_PAIRING_RSP; | 777 | smp->prsp[0] = SMP_CMD_PAIRING_RSP; |
@@ -833,6 +867,7 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
833 | struct smp_cmd_pairing cp; | 867 | struct smp_cmd_pairing cp; |
834 | struct hci_conn *hcon = conn->hcon; | 868 | struct hci_conn *hcon = conn->hcon; |
835 | struct smp_chan *smp; | 869 | struct smp_chan *smp; |
870 | u8 sec_level; | ||
836 | 871 | ||
837 | BT_DBG("conn %p", conn); | 872 | BT_DBG("conn %p", conn); |
838 | 873 | ||
@@ -842,7 +877,9 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
842 | if (!(conn->hcon->link_mode & HCI_LM_MASTER)) | 877 | if (!(conn->hcon->link_mode & HCI_LM_MASTER)) |
843 | return SMP_CMD_NOTSUPP; | 878 | return SMP_CMD_NOTSUPP; |
844 | 879 | ||
845 | hcon->pending_sec_level = authreq_to_seclevel(rp->auth_req); | 880 | sec_level = authreq_to_seclevel(rp->auth_req); |
881 | if (sec_level > hcon->pending_sec_level) | ||
882 | hcon->pending_sec_level = sec_level; | ||
846 | 883 | ||
847 | if (smp_ltk_encrypt(conn, hcon->pending_sec_level)) | 884 | if (smp_ltk_encrypt(conn, hcon->pending_sec_level)) |
848 | return 0; | 885 | return 0; |
@@ -896,9 +933,12 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level) | |||
896 | if (smp_sufficient_security(hcon, sec_level)) | 933 | if (smp_sufficient_security(hcon, sec_level)) |
897 | return 1; | 934 | return 1; |
898 | 935 | ||
936 | if (sec_level > hcon->pending_sec_level) | ||
937 | hcon->pending_sec_level = sec_level; | ||
938 | |||
899 | if (hcon->link_mode & HCI_LM_MASTER) | 939 | if (hcon->link_mode & HCI_LM_MASTER) |
900 | if (smp_ltk_encrypt(conn, sec_level)) | 940 | if (smp_ltk_encrypt(conn, hcon->pending_sec_level)) |
901 | goto done; | 941 | return 0; |
902 | 942 | ||
903 | if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags)) | 943 | if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags)) |
904 | return 0; | 944 | return 0; |
@@ -913,7 +953,7 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level) | |||
913 | * requires it. | 953 | * requires it. |
914 | */ | 954 | */ |
915 | if (hcon->io_capability != HCI_IO_NO_INPUT_OUTPUT || | 955 | if (hcon->io_capability != HCI_IO_NO_INPUT_OUTPUT || |
916 | sec_level > BT_SECURITY_MEDIUM) | 956 | hcon->pending_sec_level > BT_SECURITY_MEDIUM) |
917 | authreq |= SMP_AUTH_MITM; | 957 | authreq |= SMP_AUTH_MITM; |
918 | 958 | ||
919 | if (hcon->link_mode & HCI_LM_MASTER) { | 959 | if (hcon->link_mode & HCI_LM_MASTER) { |
@@ -932,9 +972,6 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level) | |||
932 | 972 | ||
933 | set_bit(SMP_FLAG_INITIATOR, &smp->flags); | 973 | set_bit(SMP_FLAG_INITIATOR, &smp->flags); |
934 | 974 | ||
935 | done: | ||
936 | hcon->pending_sec_level = sec_level; | ||
937 | |||
938 | return 0; | 975 | return 0; |
939 | } | 976 | } |
940 | 977 | ||
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index ea79668c2e5f..df1bb7e16cfe 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -1150,11 +1150,12 @@ void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, | |||
1150 | int err; | 1150 | int err; |
1151 | 1151 | ||
1152 | /* 24 + 6 = header + auth_algo + auth_transaction + status_code */ | 1152 | /* 24 + 6 = header + auth_algo + auth_transaction + status_code */ |
1153 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + 24 + 6 + extra_len); | 1153 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + IEEE80211_WEP_IV_LEN + |
1154 | 24 + 6 + extra_len + IEEE80211_WEP_ICV_LEN); | ||
1154 | if (!skb) | 1155 | if (!skb) |
1155 | return; | 1156 | return; |
1156 | 1157 | ||
1157 | skb_reserve(skb, local->hw.extra_tx_headroom); | 1158 | skb_reserve(skb, local->hw.extra_tx_headroom + IEEE80211_WEP_IV_LEN); |
1158 | 1159 | ||
1159 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24 + 6); | 1160 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24 + 6); |
1160 | memset(mgmt, 0, 24 + 6); | 1161 | memset(mgmt, 0, 24 + 6); |
diff --git a/net/wireless/core.h b/net/wireless/core.h index e9afbf10e756..7e3a3cef7df9 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h | |||
@@ -424,7 +424,7 @@ static inline unsigned int elapsed_jiffies_msecs(unsigned long start) | |||
424 | if (end >= start) | 424 | if (end >= start) |
425 | return jiffies_to_msecs(end - start); | 425 | return jiffies_to_msecs(end - start); |
426 | 426 | ||
427 | return jiffies_to_msecs(end + (MAX_JIFFY_OFFSET - start) + 1); | 427 | return jiffies_to_msecs(end + (ULONG_MAX - start) + 1); |
428 | } | 428 | } |
429 | 429 | ||
430 | void | 430 | void |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index c10295138eb5..082f5c62b8cf 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -1498,18 +1498,17 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, | |||
1498 | } | 1498 | } |
1499 | CMD(start_p2p_device, START_P2P_DEVICE); | 1499 | CMD(start_p2p_device, START_P2P_DEVICE); |
1500 | CMD(set_mcast_rate, SET_MCAST_RATE); | 1500 | CMD(set_mcast_rate, SET_MCAST_RATE); |
1501 | #ifdef CONFIG_NL80211_TESTMODE | ||
1502 | CMD(testmode_cmd, TESTMODE); | ||
1503 | #endif | ||
1501 | if (state->split) { | 1504 | if (state->split) { |
1502 | CMD(crit_proto_start, CRIT_PROTOCOL_START); | 1505 | CMD(crit_proto_start, CRIT_PROTOCOL_START); |
1503 | CMD(crit_proto_stop, CRIT_PROTOCOL_STOP); | 1506 | CMD(crit_proto_stop, CRIT_PROTOCOL_STOP); |
1504 | if (rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH) | 1507 | if (rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH) |
1505 | CMD(channel_switch, CHANNEL_SWITCH); | 1508 | CMD(channel_switch, CHANNEL_SWITCH); |
1509 | CMD(set_qos_map, SET_QOS_MAP); | ||
1506 | } | 1510 | } |
1507 | CMD(set_qos_map, SET_QOS_MAP); | 1511 | /* add into the if now */ |
1508 | |||
1509 | #ifdef CONFIG_NL80211_TESTMODE | ||
1510 | CMD(testmode_cmd, TESTMODE); | ||
1511 | #endif | ||
1512 | |||
1513 | #undef CMD | 1512 | #undef CMD |
1514 | 1513 | ||
1515 | if (rdev->ops->connect || rdev->ops->auth) { | 1514 | if (rdev->ops->connect || rdev->ops->auth) { |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 558b0e3a02d8..1afdf45db38f 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -935,7 +935,7 @@ freq_reg_info_regd(struct wiphy *wiphy, u32 center_freq, | |||
935 | if (!band_rule_found) | 935 | if (!band_rule_found) |
936 | band_rule_found = freq_in_rule_band(fr, center_freq); | 936 | band_rule_found = freq_in_rule_band(fr, center_freq); |
937 | 937 | ||
938 | bw_fits = reg_does_bw_fit(fr, center_freq, MHZ_TO_KHZ(5)); | 938 | bw_fits = reg_does_bw_fit(fr, center_freq, MHZ_TO_KHZ(20)); |
939 | 939 | ||
940 | if (band_rule_found && bw_fits) | 940 | if (band_rule_found && bw_fits) |
941 | return rr; | 941 | return rr; |
@@ -1019,10 +1019,10 @@ static void chan_reg_rule_print_dbg(const struct ieee80211_regdomain *regd, | |||
1019 | } | 1019 | } |
1020 | #endif | 1020 | #endif |
1021 | 1021 | ||
1022 | /* Find an ieee80211_reg_rule such that a 5MHz channel with frequency | 1022 | /* |
1023 | * chan->center_freq fits there. | 1023 | * Note that right now we assume the desired channel bandwidth |
1024 | * If there is no such reg_rule, disable the channel, otherwise set the | 1024 | * is always 20 MHz for each individual channel (HT40 uses 20 MHz |
1025 | * flags corresponding to the bandwidths allowed in the particular reg_rule | 1025 | * per channel, the primary and the extension channel). |
1026 | */ | 1026 | */ |
1027 | static void handle_channel(struct wiphy *wiphy, | 1027 | static void handle_channel(struct wiphy *wiphy, |
1028 | enum nl80211_reg_initiator initiator, | 1028 | enum nl80211_reg_initiator initiator, |
@@ -1083,12 +1083,8 @@ static void handle_channel(struct wiphy *wiphy, | |||
1083 | if (reg_rule->flags & NL80211_RRF_AUTO_BW) | 1083 | if (reg_rule->flags & NL80211_RRF_AUTO_BW) |
1084 | max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule); | 1084 | max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule); |
1085 | 1085 | ||
1086 | if (max_bandwidth_khz < MHZ_TO_KHZ(10)) | ||
1087 | bw_flags = IEEE80211_CHAN_NO_10MHZ; | ||
1088 | if (max_bandwidth_khz < MHZ_TO_KHZ(20)) | ||
1089 | bw_flags |= IEEE80211_CHAN_NO_20MHZ; | ||
1090 | if (max_bandwidth_khz < MHZ_TO_KHZ(40)) | 1086 | if (max_bandwidth_khz < MHZ_TO_KHZ(40)) |
1091 | bw_flags |= IEEE80211_CHAN_NO_HT40; | 1087 | bw_flags = IEEE80211_CHAN_NO_HT40; |
1092 | if (max_bandwidth_khz < MHZ_TO_KHZ(80)) | 1088 | if (max_bandwidth_khz < MHZ_TO_KHZ(80)) |
1093 | bw_flags |= IEEE80211_CHAN_NO_80MHZ; | 1089 | bw_flags |= IEEE80211_CHAN_NO_80MHZ; |
1094 | if (max_bandwidth_khz < MHZ_TO_KHZ(160)) | 1090 | if (max_bandwidth_khz < MHZ_TO_KHZ(160)) |
@@ -1522,12 +1518,8 @@ static void handle_channel_custom(struct wiphy *wiphy, | |||
1522 | if (reg_rule->flags & NL80211_RRF_AUTO_BW) | 1518 | if (reg_rule->flags & NL80211_RRF_AUTO_BW) |
1523 | max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule); | 1519 | max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule); |
1524 | 1520 | ||
1525 | if (max_bandwidth_khz < MHZ_TO_KHZ(10)) | ||
1526 | bw_flags = IEEE80211_CHAN_NO_10MHZ; | ||
1527 | if (max_bandwidth_khz < MHZ_TO_KHZ(20)) | ||
1528 | bw_flags |= IEEE80211_CHAN_NO_20MHZ; | ||
1529 | if (max_bandwidth_khz < MHZ_TO_KHZ(40)) | 1521 | if (max_bandwidth_khz < MHZ_TO_KHZ(40)) |
1530 | bw_flags |= IEEE80211_CHAN_NO_HT40; | 1522 | bw_flags = IEEE80211_CHAN_NO_HT40; |
1531 | if (max_bandwidth_khz < MHZ_TO_KHZ(80)) | 1523 | if (max_bandwidth_khz < MHZ_TO_KHZ(80)) |
1532 | bw_flags |= IEEE80211_CHAN_NO_80MHZ; | 1524 | bw_flags |= IEEE80211_CHAN_NO_80MHZ; |
1533 | if (max_bandwidth_khz < MHZ_TO_KHZ(160)) | 1525 | if (max_bandwidth_khz < MHZ_TO_KHZ(160)) |