Skip to content

Commit 1b0608f

Browse files
committed
Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
John W. Linville says: ==================== pull request: wireless 2014-06-18 Please pull this batch of fixes intended for the 3.16 stream! For the Bluetooth bits, Gustavo says: "This is our first batch of fixes for 3.16. Be aware that two patches here are not exactly bugfixes: * 71f28af57066 Bluetooth: Add clarifying comment for conn->auth_type This commit just add some important security comments to the code, we found it important enough to include it here for 3.16 since it is security related. * 9f7ec8871132 Bluetooth: Refactor discovery stopping into its own function This commit is just a refactor in a preparation for a fix in the next commit (f8680f1). All the other patches are fixes for deadlocks and for the Bluetooth protocols, most of them related to authentication and encryption." On top of that... Chin-Ran Lo fixes a problems with overlapping DMA areas in mwifiex. Michael Braun corrects a couple of issues in order to enable a new device in rt2800usb. Rafał Miłecki reverts a b43 patch that caused a regression, fixes a Kconfig typo, and corrects a frequency reporting error with the G-PHY. Stanislaw Grsuzka fixes an rfkill regression for rt2500pci, and avoids a rt2x00 scheduling while atomic BUG. Please let me know if there are problems! ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 24599e6 + 2ee3f63 commit 1b0608f

File tree

17 files changed

+196
-88
lines changed

17 files changed

+196
-88
lines changed

drivers/net/wireless/b43/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ config B43_SSB
3636
choice
3737
prompt "Supported bus types"
3838
depends on B43
39-
default B43_BCMA_AND_SSB
39+
default B43_BUSES_BCMA_AND_SSB
4040

4141
config B43_BUSES_BCMA_AND_SSB
4242
bool "BCMA and SSB"

drivers/net/wireless/b43/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5221,6 +5221,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
52215221
/* We don't support 5 GHz on some PHYs yet */
52225222
switch (dev->phy.type) {
52235223
case B43_PHYTYPE_A:
5224+
case B43_PHYTYPE_G:
52245225
case B43_PHYTYPE_N:
52255226
case B43_PHYTYPE_LP:
52265227
case B43_PHYTYPE_HT:

drivers/net/wireless/b43/xmit.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -811,9 +811,13 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
811811
break;
812812
case B43_PHYTYPE_G:
813813
status.band = IEEE80211_BAND_2GHZ;
814-
/* chanid is the radio channel cookie value as used
815-
* to tune the radio. */
816-
status.freq = chanid + 2400;
814+
/* Somewhere between 478.104 and 508.1084 firmware for G-PHY
815+
* has been modified to be compatible with N-PHY and others.
816+
*/
817+
if (dev->fw.rev >= 508)
818+
status.freq = ieee80211_channel_to_frequency(chanid, status.band);
819+
else
820+
status.freq = chanid + 2400;
817821
break;
818822
case B43_PHYTYPE_N:
819823
case B43_PHYTYPE_LP:

drivers/net/wireless/mwifiex/pcie.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ mwifiex_map_pci_memory(struct mwifiex_adapter *adapter, struct sk_buff *skb,
5050
return -1;
5151
}
5252
mapping.len = size;
53-
memcpy(skb->cb, &mapping, sizeof(mapping));
53+
mwifiex_store_mapping(skb, &mapping);
5454
return 0;
5555
}
5656

@@ -60,7 +60,7 @@ static void mwifiex_unmap_pci_memory(struct mwifiex_adapter *adapter,
6060
struct pcie_service_card *card = adapter->card;
6161
struct mwifiex_dma_mapping mapping;
6262

63-
MWIFIEX_SKB_PACB(skb, &mapping);
63+
mwifiex_get_mapping(skb, &mapping);
6464
pci_unmap_single(card->dev, mapping.addr, mapping.len, flags);
6565
}
6666

drivers/net/wireless/mwifiex/util.h

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,55 @@
2020
#ifndef _MWIFIEX_UTIL_H_
2121
#define _MWIFIEX_UTIL_H_
2222

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+
2336
static inline struct mwifiex_rxinfo *MWIFIEX_SKB_RXCB(struct sk_buff *skb)
2437
{
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;
2642
}
2743

2844
static inline struct mwifiex_txinfo *MWIFIEX_SKB_TXCB(struct sk_buff *skb)
2945
{
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;
3149
}
3250

33-
struct mwifiex_dma_mapping {
34-
dma_addr_t addr;
35-
size_t len;
36-
};
51+
static inline void mwifiex_store_mapping(struct sk_buff *skb,
52+
struct mwifiex_dma_mapping *mapping)
53+
{
54+
struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb;
55+
56+
memcpy(&cb->dma_mapping, mapping, sizeof(*mapping));
57+
}
3758

38-
static inline void MWIFIEX_SKB_PACB(struct sk_buff *skb,
39-
struct mwifiex_dma_mapping *mapping)
59+
static inline void mwifiex_get_mapping(struct sk_buff *skb,
60+
struct mwifiex_dma_mapping *mapping)
4061
{
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));
4265
}
4366

4467
static inline dma_addr_t MWIFIEX_SKB_DMA_ADDR(struct sk_buff *skb)
4568
{
4669
struct mwifiex_dma_mapping mapping;
4770

48-
MWIFIEX_SKB_PACB(skb, &mapping);
71+
mwifiex_get_mapping(skb, &mapping);
4972

5073
return mapping.addr;
5174
}

drivers/net/wireless/rt2x00/rt2500pci.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1681,8 +1681,13 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
16811681
/*
16821682
* Detect if this device has an hardware controlled radio.
16831683
*/
1684-
if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
1684+
if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) {
16851685
__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+
}
16861691

16871692
/*
16881693
* Check if the BBP tuning should be enabled.

drivers/net/wireless/rt2x00/rt2800usb.c

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,27 @@ static enum hrtimer_restart rt2800usb_tx_sta_fifo_timeout(struct hrtimer *timer)
229229
/*
230230
* Firmware functions
231231
*/
232+
static int rt2800usb_autorun_detect(struct rt2x00_dev *rt2x00dev)
233+
{
234+
__le32 reg;
235+
u32 fw_mode;
236+
237+
/* cannot use rt2x00usb_register_read here as it uses different
238+
* mode (MULTI_READ vs. DEVICE_MODE) and does not pass the
239+
* magic value USB_MODE_AUTORUN (0x11) to the device, thus the
240+
* returned value would be invalid.
241+
*/
242+
rt2x00usb_vendor_request(rt2x00dev, USB_DEVICE_MODE,
243+
USB_VENDOR_REQUEST_IN, 0, USB_MODE_AUTORUN,
244+
&reg, sizeof(reg), REGISTER_TIMEOUT_FIRMWARE);
245+
fw_mode = le32_to_cpu(reg);
246+
247+
if ((fw_mode & 0x00000003) == 2)
248+
return 1;
249+
250+
return 0;
251+
}
252+
232253
static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev)
233254
{
234255
return FIRMWARE_RT2870;
@@ -257,8 +278,13 @@ static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev,
257278
/*
258279
* Write firmware to device.
259280
*/
260-
rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE,
261-
data + offset, length);
281+
if (rt2800usb_autorun_detect(rt2x00dev)) {
282+
rt2x00_info(rt2x00dev,
283+
"Firmware loading not required - NIC in AutoRun mode\n");
284+
} else {
285+
rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE,
286+
data + offset, length);
287+
}
262288

263289
rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
264290
rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0);
@@ -735,11 +761,18 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry,
735761
/*
736762
* Device probe functions.
737763
*/
764+
static int rt2800usb_efuse_detect(struct rt2x00_dev *rt2x00dev)
765+
{
766+
if (rt2800usb_autorun_detect(rt2x00dev))
767+
return 1;
768+
return rt2800_efuse_detect(rt2x00dev);
769+
}
770+
738771
static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev)
739772
{
740773
int retval;
741774

742-
if (rt2800_efuse_detect(rt2x00dev))
775+
if (rt2800usb_efuse_detect(rt2x00dev))
743776
retval = rt2800_read_eeprom_efuse(rt2x00dev);
744777
else
745778
retval = rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom,

drivers/net/wireless/rt2x00/rt2x00.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,7 @@ enum rt2x00_capability_flags {
693693
REQUIRE_SW_SEQNO,
694694
REQUIRE_HT_TX_DESC,
695695
REQUIRE_PS_AUTOWAKE,
696+
REQUIRE_DELAYED_RFKILL,
696697

697698
/*
698699
* Capabilities

drivers/net/wireless/rt2x00/rt2x00dev.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,9 +1126,10 @@ static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev)
11261126
return;
11271127

11281128
/*
1129-
* Unregister extra components.
1129+
* Stop rfkill polling.
11301130
*/
1131-
rt2x00rfkill_unregister(rt2x00dev);
1131+
if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
1132+
rt2x00rfkill_unregister(rt2x00dev);
11321133

11331134
/*
11341135
* Allow the HW to uninitialize.
@@ -1166,6 +1167,12 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev)
11661167

11671168
set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags);
11681169

1170+
/*
1171+
* Start rfkill polling.
1172+
*/
1173+
if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
1174+
rt2x00rfkill_register(rt2x00dev);
1175+
11691176
return 0;
11701177
}
11711178

@@ -1375,7 +1382,12 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
13751382
rt2x00link_register(rt2x00dev);
13761383
rt2x00leds_register(rt2x00dev);
13771384
rt2x00debug_register(rt2x00dev);
1378-
rt2x00rfkill_register(rt2x00dev);
1385+
1386+
/*
1387+
* Start rfkill polling.
1388+
*/
1389+
if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
1390+
rt2x00rfkill_register(rt2x00dev);
13791391

13801392
return 0;
13811393

@@ -1390,6 +1402,12 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
13901402
{
13911403
clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
13921404

1405+
/*
1406+
* Stop rfkill polling.
1407+
*/
1408+
if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
1409+
rt2x00rfkill_unregister(rt2x00dev);
1410+
13931411
/*
13941412
* Disable radio.
13951413
*/

drivers/net/wireless/rt2x00/rt2x00mac.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,8 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
487487
crypto.cipher = rt2x00crypto_key_to_cipher(key);
488488
if (crypto.cipher == CIPHER_NONE)
489489
return -EOPNOTSUPP;
490+
if (crypto.cipher == CIPHER_TKIP && rt2x00_is_usb(rt2x00dev))
491+
return -EOPNOTSUPP;
490492

491493
crypto.cmd = cmd;
492494

0 commit comments

Comments
 (0)