aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43legacy/pio.c
diff options
context:
space:
mode:
authorStefano Brivio <stefano.brivio@polimi.it>2008-02-02 13:16:01 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-02-05 14:35:46 -0500
commit9eca9a8e81928685b4de00ecef83a7c13c340fc9 (patch)
tree9029574fe8c64a8b75c3f682d6ba2f4fd1ced504 /drivers/net/wireless/b43legacy/pio.c
parentada50731c0346bf900dc387edd3a6961297bf2d3 (diff)
b43legacy: drop packets we are not able to encrypt
We must drop any packets we are not able to encrypt. We must not send them unencrypted or with an all-zero-key (which basically is the same as unencrypted, from a security point of view). This might only trigger shortly after resume before mac80211 reassociated and reconfigured the keys. It is safe to drop these packets, as the association they belong to is not guaranteed anymore anyway. This is a security fix in the sense that it prevents information leakage. This patch by Michael Buesch has been ported to b43legacy. Cc: Michael Buesch <mb@bu3sch.de> Signed-off-by: Stefano Brivio <stefano.brivio@polimi.it> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43legacy/pio.c')
-rw-r--r--drivers/net/wireless/b43legacy/pio.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/net/wireless/b43legacy/pio.c b/drivers/net/wireless/b43legacy/pio.c
index 1f48ec7fbe9a..bcdd54eb2edb 100644
--- a/drivers/net/wireless/b43legacy/pio.c
+++ b/drivers/net/wireless/b43legacy/pio.c
@@ -181,7 +181,7 @@ union txhdr_union {
181 struct b43legacy_txhdr_fw3 txhdr_fw3; 181 struct b43legacy_txhdr_fw3 txhdr_fw3;
182}; 182};
183 183
184static void pio_tx_write_fragment(struct b43legacy_pioqueue *queue, 184static int pio_tx_write_fragment(struct b43legacy_pioqueue *queue,
185 struct sk_buff *skb, 185 struct sk_buff *skb,
186 struct b43legacy_pio_txpacket *packet, 186 struct b43legacy_pio_txpacket *packet,
187 size_t txhdr_size) 187 size_t txhdr_size)
@@ -189,14 +189,17 @@ static void pio_tx_write_fragment(struct b43legacy_pioqueue *queue,
189 union txhdr_union txhdr_data; 189 union txhdr_union txhdr_data;
190 u8 *txhdr = NULL; 190 u8 *txhdr = NULL;
191 unsigned int octets; 191 unsigned int octets;
192 int err;
192 193
193 txhdr = (u8 *)(&txhdr_data.txhdr_fw3); 194 txhdr = (u8 *)(&txhdr_data.txhdr_fw3);
194 195
195 B43legacy_WARN_ON(skb_shinfo(skb)->nr_frags != 0); 196 B43legacy_WARN_ON(skb_shinfo(skb)->nr_frags != 0);
196 b43legacy_generate_txhdr(queue->dev, 197 err = b43legacy_generate_txhdr(queue->dev,
197 txhdr, skb->data, skb->len, 198 txhdr, skb->data, skb->len,
198 &packet->txstat.control, 199 &packet->txstat.control,
199 generate_cookie(queue, packet)); 200 generate_cookie(queue, packet));
201 if (err)
202 return err;
200 203
201 tx_start(queue); 204 tx_start(queue);
202 octets = skb->len + txhdr_size; 205 octets = skb->len + txhdr_size;
@@ -204,6 +207,8 @@ static void pio_tx_write_fragment(struct b43legacy_pioqueue *queue,
204 octets--; 207 octets--;
205 tx_data(queue, txhdr, (u8 *)skb->data, octets); 208 tx_data(queue, txhdr, (u8 *)skb->data, octets);
206 tx_complete(queue, skb); 209 tx_complete(queue, skb);
210
211 return 0;
207} 212}
208 213
209static void free_txpacket(struct b43legacy_pio_txpacket *packet, 214static void free_txpacket(struct b43legacy_pio_txpacket *packet,
@@ -226,6 +231,7 @@ static int pio_tx_packet(struct b43legacy_pio_txpacket *packet)
226 struct b43legacy_pioqueue *queue = packet->queue; 231 struct b43legacy_pioqueue *queue = packet->queue;
227 struct sk_buff *skb = packet->skb; 232 struct sk_buff *skb = packet->skb;
228 u16 octets; 233 u16 octets;
234 int err;
229 235
230 octets = (u16)skb->len + sizeof(struct b43legacy_txhdr_fw3); 236 octets = (u16)skb->len + sizeof(struct b43legacy_txhdr_fw3);
231 if (queue->tx_devq_size < octets) { 237 if (queue->tx_devq_size < octets) {
@@ -247,8 +253,14 @@ static int pio_tx_packet(struct b43legacy_pio_txpacket *packet)
247 if (queue->tx_devq_used + octets > queue->tx_devq_size) 253 if (queue->tx_devq_used + octets > queue->tx_devq_size)
248 return -EBUSY; 254 return -EBUSY;
249 /* Now poke the device. */ 255 /* Now poke the device. */
250 pio_tx_write_fragment(queue, skb, packet, 256 err = pio_tx_write_fragment(queue, skb, packet,
251 sizeof(struct b43legacy_txhdr_fw3)); 257 sizeof(struct b43legacy_txhdr_fw3));
258 if (unlikely(err == -ENOKEY)) {
259 /* Drop this packet, as we don't have the encryption key
260 * anymore and must not transmit it unencrypted. */
261 free_txpacket(packet, 1);
262 return 0;
263 }
252 264
253 /* Account for the packet size. 265 /* Account for the packet size.
254 * (We must not overflow the device TX queue) 266 * (We must not overflow the device TX queue)