History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6: iwlwifi: fix device id registration for 6000 series 2x2 devices ath5k: update channel in sw state after stopping RX and TX rtl8187: use DMA-aware buffers with usb_control_msg mac80211: avoid NULL ptr deref when finding max_rates in PID and minstrel airo: airo_get_encode{,ext} potential buffer overflow Pulled directly by Linus because Davem is off playing shuffle-board at some Alaskan cruise, and the NULL ptr deref issue hits people and should get merged sooner rather than later. David - make us proud on the shuffle-board tournament!

Linus Torvalds committed 17 years ago

Commit 33468572 parents 5d41343 542cc799 files · +91 −33Browse files

Unified · Split

9 files
  1. drivers/net/wireless/airo.c +8 −2
  2. drivers/net/wireless/ath5k/base.c +13 −9
  3. drivers/net/wireless/iwlwifi/iwl-6000.c +4 −4
  4. drivers/net/wireless/iwlwifi/iwl-agn.c +2 −0
  5. drivers/net/wireless/rtl818x/rtl8187.h +43 −14
  6. drivers/net/wireless/rtl818x/rtl8187_dev.c +12 −1
  7. drivers/net/wireless/rtl818x/rtl8187_rtl8225.c +7 −1
  8. net/mac80211/rc80211_minstrel.c +1 −1
  9. net/mac80211/rc80211_pid_algo.c +1 −1
drivers/net/wireless/airo.c+8−2
@@ -6501,7 +6501,10 @@ static int airo_get_encode(struct net_device *dev, · 6500 unmodified lines
65016501
65026502 /* Copy the key to the user buffer */
65036503 dwrq->length = get_wep_key(local, index, &buf[0], sizeof(buf));
6504− memcpy(extra, buf, dwrq->length);
6504+ if (dwrq->length != -1)
6505+ memcpy(extra, buf, dwrq->length);
6506+ else
6507+ dwrq->length = 0;
65056508
65066509 return 0;
65076510 }
@@ -6659,7 +6662,10 @@ static int airo_get_encodeext(struct net_device *dev, · 151 unmodified lines
66596662
66606663 /* Copy the key to the user buffer */
66616664 ext->key_len = get_wep_key(local, idx, &buf[0], sizeof(buf));
6662− memcpy(extra, buf, ext->key_len);
6665+ if (ext->key_len != -1)
6666+ memcpy(extra, buf, ext->key_len);
6667+ else
6668+ ext->key_len = 0;
66636669
66646670 return 0;
66656671 }
drivers/net/wireless/ath5k/base.c+13−9
@@ -214,7 +214,7 @@ static struct pci_driver ath5k_pci_driver = { · 213 unmodified lines
214214 * Prototypes - MAC 802.11 stack related functions
215215 */
216216 static int ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb);
217−static int ath5k_reset(struct ath5k_softc *sc, bool stop, bool change_channel);
217+static int ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan);
218218 static int ath5k_reset_wake(struct ath5k_softc *sc);
219219 static int ath5k_start(struct ieee80211_hw *hw);
220220 static void ath5k_stop(struct ieee80211_hw *hw);
@@ -1038,16 +1038,13 @@ ath5k_chan_set(struct ath5k_softc *sc, struct ieee80211_channel *chan) · 817 unmodified lines
10381038 if (chan->center_freq != sc->curchan->center_freq ||
10391039 chan->hw_value != sc->curchan->hw_value) {
10401040
1041− sc->curchan = chan;
1042− sc->curband = &sc->sbands[chan->band];
1043−
10441041 /*
10451042 * To switch channels clear any pending DMA operations;
10461043 * wait long enough for the RX fifo to drain, reset the
10471044 * hardware at the new frequency, and then re-enable
10481045 * the relevant bits of the h/w.
10491046 */
1050− return ath5k_reset(sc, true, true);
1047+ return ath5k_reset(sc, chan);
10511048 }
10521049
10531050 return 0;
@@ -2314,7 +2311,7 @@ ath5k_init(struct ath5k_softc *sc) · 1260 unmodified lines
23142311 sc->imask = AR5K_INT_RXOK | AR5K_INT_RXERR | AR5K_INT_RXEOL |
23152312 AR5K_INT_RXORN | AR5K_INT_TXDESC | AR5K_INT_TXEOL |
23162313 AR5K_INT_FATAL | AR5K_INT_GLOBAL;
2317− ret = ath5k_reset(sc, false, false);
2314+ ret = ath5k_reset(sc, NULL);
23182315 if (ret)
23192316 goto done;
23202317
@@ -2599,18 +2596,25 @@ drop_packet: · 278 unmodified lines
25992596 return NETDEV_TX_OK;
26002597 }
26012598
2599+/*
2600+ * Reset the hardware. If chan is not NULL, then also pause rx/tx
2601+ * and change to the given channel.
2602+ */
26022603 static int
2603−ath5k_reset(struct ath5k_softc *sc, bool stop, bool change_channel)
2604+ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan)
26042605 {
26052606 struct ath5k_hw *ah = sc->ah;
26062607 int ret;
26072608
26082609 ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "resetting\n");
26092610
2610− if (stop) {
2611+ if (chan) {
26112612 ath5k_hw_set_imr(ah, 0);
26122613 ath5k_txq_cleanup(sc);
26132614 ath5k_rx_stop(sc);
2615+
2616+ sc->curchan = chan;
2617+ sc->curband = &sc->sbands[chan->band];
26142618 }
26152619 ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, true);
26162620 if (ret) {
@@ -2648,7 +2652,7 @@ ath5k_reset_wake(struct ath5k_softc *sc) · 31 unmodified lines
26482652 {
26492653 int ret;
26502654
2651− ret = ath5k_reset(sc, true, true);
2655+ ret = ath5k_reset(sc, sc->curchan);
26522656 if (!ret)
26532657 ieee80211_wake_queues(sc->hw);
26542658
drivers/net/wireless/iwlwifi/iwl-6000.c+4−4
@@ -101,8 +101,8 @@ struct iwl_cfg iwl6000_2agn_cfg = { · 100 unmodified lines
101101 .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
102102 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
103103 .mod_params = &iwl50_mod_params,
104− .valid_tx_ant = ANT_BC,
105− .valid_rx_ant = ANT_BC,
104+ .valid_tx_ant = ANT_AB,
105+ .valid_rx_ant = ANT_AB,
106106 .need_pll_cfg = false,
107107 };
108108
@@ -117,8 +117,8 @@ struct iwl_cfg iwl6050_2agn_cfg = { · 8 unmodified lines
117117 .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
118118 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
119119 .mod_params = &iwl50_mod_params,
120− .valid_tx_ant = ANT_BC,
121− .valid_rx_ant = ANT_BC,
120+ .valid_tx_ant = ANT_AB,
121+ .valid_rx_ant = ANT_AB,
122122 .need_pll_cfg = false,
123123 };
124124
drivers/net/wireless/iwlwifi/iwl-agn.c+2−0
@@ -3636,7 +3636,9 @@ static struct pci_device_id iwl_hw_card_ids[] = { · 3635 unmodified lines
36363636 {IWL_PCI_DEVICE(0x0085, 0x1112, iwl6000_2ag_cfg)},
36373637 {IWL_PCI_DEVICE(0x0082, 0x1122, iwl6000_2ag_cfg)},
36383638 {IWL_PCI_DEVICE(0x422B, PCI_ANY_ID, iwl6000_3agn_cfg)},
3639+ {IWL_PCI_DEVICE(0x422C, PCI_ANY_ID, iwl6000_2agn_cfg)},
36393640 {IWL_PCI_DEVICE(0x4238, PCI_ANY_ID, iwl6000_3agn_cfg)},
3641+ {IWL_PCI_DEVICE(0x4239, PCI_ANY_ID, iwl6000_2agn_cfg)},
36403642 {IWL_PCI_DEVICE(0x0082, PCI_ANY_ID, iwl6000_2agn_cfg)},
36413643 {IWL_PCI_DEVICE(0x0085, PCI_ANY_ID, iwl6000_3agn_cfg)},
36423644 {IWL_PCI_DEVICE(0x0086, PCI_ANY_ID, iwl6050_3agn_cfg)},
drivers/net/wireless/rtl818x/rtl8187.h+43−14
@@ -120,6 +120,12 @@ struct rtl8187_priv { · 119 unmodified lines
120120 __le64 buf;
121121 struct sk_buff_head queue;
122122 } b_tx_status; /* This queue is used by both -b and non-b devices */
123+ struct mutex io_mutex;
124+ union {
125+ u8 bits8;
126+ __le16 bits16;
127+ __le32 bits32;
128+ } *io_dmabuf;
123129 };
124130
125131 void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);
@@ -129,10 +135,14 @@ static inline u8 rtl818x_ioread8_idx(struct rtl8187_priv *priv, · 3 unmodified lines
129135 {
130136 u8 val;
131137
138+ mutex_lock(&priv->io_mutex);
132139 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
133140 RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
134− (unsigned long)addr, idx & 0x03, &val,
135− sizeof(val), HZ / 2);
141+ (unsigned long)addr, idx & 0x03,
142+ &priv->io_dmabuf->bits8, sizeof(val), HZ / 2);
143+
144+ val = priv->io_dmabuf->bits8;
145+ mutex_unlock(&priv->io_mutex);
136146
137147 return val;
138148 }
@@ -147,10 +157,14 @@ static inline u16 rtl818x_ioread16_idx(struct rtl8187_priv *priv, · 8 unmodified lines
147157 {
148158 __le16 val;
149159
160+ mutex_lock(&priv->io_mutex);
150161 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
151162 RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
152− (unsigned long)addr, idx & 0x03, &val,
153− sizeof(val), HZ / 2);
163+ (unsigned long)addr, idx & 0x03,
164+ &priv->io_dmabuf->bits16, sizeof(val), HZ / 2);
165+
166+ val = priv->io_dmabuf->bits16;
167+ mutex_unlock(&priv->io_mutex);
154168
155169 return le16_to_cpu(val);
156170 }
@@ -165,10 +179,14 @@ static inline u32 rtl818x_ioread32_idx(struct rtl8187_priv *priv, · 8 unmodified lines
165179 {
166180 __le32 val;
167181
182+ mutex_lock(&priv->io_mutex);
168183 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
169184 RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
170− (unsigned long)addr, idx & 0x03, &val,
171− sizeof(val), HZ / 2);
185+ (unsigned long)addr, idx & 0x03,
186+ &priv->io_dmabuf->bits32, sizeof(val), HZ / 2);
187+
188+ val = priv->io_dmabuf->bits32;
189+ mutex_unlock(&priv->io_mutex);
172190
173191 return le32_to_cpu(val);
174192 }
@@ -181,10 +199,15 @@ static inline u32 rtl818x_ioread32(struct rtl8187_priv *priv, __le32 *addr) · 6 unmodified lines
181199 static inline void rtl818x_iowrite8_idx(struct rtl8187_priv *priv,
182200 u8 *addr, u8 val, u8 idx)
183201 {
202+ mutex_lock(&priv->io_mutex);
203+
204+ priv->io_dmabuf->bits8 = val;
184205 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
185206 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
186− (unsigned long)addr, idx & 0x03, &val,
187− sizeof(val), HZ / 2);
207+ (unsigned long)addr, idx & 0x03,
208+ &priv->io_dmabuf->bits8, sizeof(val), HZ / 2);
209+
210+ mutex_unlock(&priv->io_mutex);
188211 }
189212
190213 static inline void rtl818x_iowrite8(struct rtl8187_priv *priv, u8 *addr, u8 val)
@@ -195,12 +218,15 @@ static inline void rtl818x_iowrite8(struct rtl8187_priv *priv, u8 *addr, u8 val) · 4 unmodified lines
195218 static inline void rtl818x_iowrite16_idx(struct rtl8187_priv *priv,
196219 __le16 *addr, u16 val, u8 idx)
197220 {
198− __le16 buf = cpu_to_le16(val);
221+ mutex_lock(&priv->io_mutex);
199222
223+ priv->io_dmabuf->bits16 = cpu_to_le16(val);
200224 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
201225 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
202− (unsigned long)addr, idx & 0x03, &buf, sizeof(buf),
203− HZ / 2);
226+ (unsigned long)addr, idx & 0x03,
227+ &priv->io_dmabuf->bits16, sizeof(val), HZ / 2);
228+
229+ mutex_unlock(&priv->io_mutex);
204230 }
205231
206232 static inline void rtl818x_iowrite16(struct rtl8187_priv *priv, __le16 *addr,
@@ -212,12 +238,15 @@ static inline void rtl818x_iowrite16(struct rtl8187_priv *priv, __le16 *addr, · 5 unmodified lines
212238 static inline void rtl818x_iowrite32_idx(struct rtl8187_priv *priv,
213239 __le32 *addr, u32 val, u8 idx)
214240 {
215− __le32 buf = cpu_to_le32(val);
241+ mutex_lock(&priv->io_mutex);
216242
243+ priv->io_dmabuf->bits32 = cpu_to_le32(val);
217244 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
218245 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
219− (unsigned long)addr, idx & 0x03, &buf, sizeof(buf),
220− HZ / 2);
246+ (unsigned long)addr, idx & 0x03,
247+ &priv->io_dmabuf->bits32, sizeof(val), HZ / 2);
248+
249+ mutex_unlock(&priv->io_mutex);
221250 }
222251
223252 static inline void rtl818x_iowrite32(struct rtl8187_priv *priv, __le32 *addr,
drivers/net/wireless/rtl818x/rtl8187_dev.c+12−1
@@ -1329,6 +1329,14 @@ static int __devinit rtl8187_probe(struct usb_interface *intf, · 1328 unmodified lines
13291329 priv = dev->priv;
13301330 priv->is_rtl8187b = (id->driver_info == DEVICE_RTL8187B);
13311331
1332+ /* allocate "DMA aware" buffer for register accesses */
1333+ priv->io_dmabuf = kmalloc(sizeof(*priv->io_dmabuf), GFP_KERNEL);
1334+ if (!priv->io_dmabuf) {
1335+ err = -ENOMEM;
1336+ goto err_free_dev;
1337+ }
1338+ mutex_init(&priv->io_mutex);
1339+
13321340 SET_IEEE80211_DEV(dev, &intf->dev);
13331341 usb_set_intfdata(intf, dev);
13341342 priv->udev = udev;
@@ -1495,7 +1503,7 @@ static int __devinit rtl8187_probe(struct usb_interface *intf, · 160 unmodified lines
14951503 err = ieee80211_register_hw(dev);
14961504 if (err) {
14971505 printk(KERN_ERR "rtl8187: Cannot register device\n");
1498− goto err_free_dev;
1506+ goto err_free_dmabuf;
14991507 }
15001508 mutex_init(&priv->conf_mutex);
15011509 skb_queue_head_init(&priv->b_tx_status.queue);
@@ -1506,6 +1514,8 @@ static int __devinit rtl8187_probe(struct usb_interface *intf, · 4 unmodified lines
15061514
15071515 return 0;
15081516
1517+ err_free_dmabuf:
1518+ kfree(priv->io_dmabuf);
15091519 err_free_dev:
15101520 ieee80211_free_hw(dev);
15111521 usb_set_intfdata(intf, NULL);
@@ -1526,6 +1536,7 @@ static void __devexit rtl8187_disconnect(struct usb_interface *intf) · 14 unmodified lines
15261536 priv = dev->priv;
15271537 usb_reset_device(priv->udev);
15281538 usb_put_dev(interface_to_usbdev(intf));
1539+ kfree(priv->io_dmabuf);
15291540 ieee80211_free_hw(dev);
15301541 }
15311542
drivers/net/wireless/rtl818x/rtl8187_rtl8225.c+7−1
@@ -88,9 +88,15 @@ static void rtl8225_write_8051(struct ieee80211_hw *dev, u8 addr, __le16 data) · 87 unmodified lines
8888 rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80);
8989 udelay(10);
9090
91+ mutex_lock(&priv->io_mutex);
92+
93+ priv->io_dmabuf->bits16 = data;
9194 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
9295 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
93− addr, 0x8225, &data, sizeof(data), HZ / 2);
96+ addr, 0x8225, &priv->io_dmabuf->bits16, sizeof(data),
97+ HZ / 2);
98+
99+ mutex_unlock(&priv->io_mutex);
94100
95101 rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
96102 udelay(10);
net/mac80211/rc80211_minstrel.c+1−1
@@ -477,7 +477,7 @@ minstrel_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) · 476 unmodified lines
477477
478478 for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
479479 sband = hw->wiphy->bands[i];
480− if (sband->n_bitrates > max_rates)
480+ if (sband && sband->n_bitrates > max_rates)
481481 max_rates = sband->n_bitrates;
482482 }
483483
net/mac80211/rc80211_pid_algo.c+1−1
@@ -378,7 +378,7 @@ static void *rate_control_pid_alloc(struct ieee80211_hw *hw, · 377 unmodified lines
378378
379379 for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
380380 sband = hw->wiphy->bands[i];
381− if (sband->n_bitrates > max_rates)
381+ if (sband && sband->n_bitrates > max_rates)
382382 max_rates = sband->n_bitrates;
383383 }
384384

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t