aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt73usb.c
diff options
context:
space:
mode:
authorSeth Forshee <seth.forshee@canonical.com>2011-02-14 09:52:25 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-02-14 15:50:17 -0500
commitd76dfc612b40b6a9de0a3fe57fe1fa3db7a1ae3b (patch)
tree169aca14bd1a3514452aeac5170214280937a6eb /drivers/net/wireless/rt2x00/rt73usb.c
parenta3dc5e881a8a5199bf371fdd4530cfa18280ca83 (diff)
rt2x00: Check for errors from skb_pad() calls
Commit 739fd94 ("rt2x00: Pad beacon to multiple of 32 bits") added calls to skb_pad() without checking the return value, which could cause problems if any of those calls does happen to fail. Add checks to prevent this from happening. Signed-off-by: Seth Forshee <seth.forshee@canonical.com> Acked-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt73usb.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 5ff72deea8d4..6e9981a1dd7f 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -1533,13 +1533,14 @@ static void rt73usb_write_beacon(struct queue_entry *entry,
1533 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 1533 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
1534 unsigned int beacon_base; 1534 unsigned int beacon_base;
1535 unsigned int padding_len; 1535 unsigned int padding_len;
1536 u32 reg; 1536 u32 orig_reg, reg;
1537 1537
1538 /* 1538 /*
1539 * Disable beaconing while we are reloading the beacon data, 1539 * Disable beaconing while we are reloading the beacon data,
1540 * otherwise we might be sending out invalid data. 1540 * otherwise we might be sending out invalid data.
1541 */ 1541 */
1542 rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, &reg); 1542 rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, &reg);
1543 orig_reg = reg;
1543 rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 0); 1544 rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 0);
1544 rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); 1545 rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg);
1545 1546
@@ -1563,7 +1564,14 @@ static void rt73usb_write_beacon(struct queue_entry *entry,
1563 * Write entire beacon with descriptor and padding to register. 1564 * Write entire beacon with descriptor and padding to register.
1564 */ 1565 */
1565 padding_len = roundup(entry->skb->len, 4) - entry->skb->len; 1566 padding_len = roundup(entry->skb->len, 4) - entry->skb->len;
1566 skb_pad(entry->skb, padding_len); 1567 if (padding_len && skb_pad(entry->skb, padding_len)) {
1568 ERROR(rt2x00dev, "Failure padding beacon, aborting\n");
1569 /* skb freed by skb_pad() on failure */
1570 entry->skb = NULL;
1571 rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, orig_reg);
1572 return;
1573 }
1574
1567 beacon_base = HW_BEACON_OFFSET(entry->entry_idx); 1575 beacon_base = HW_BEACON_OFFSET(entry->entry_idx);
1568 rt2x00usb_register_multiwrite(rt2x00dev, beacon_base, entry->skb->data, 1576 rt2x00usb_register_multiwrite(rt2x00dev, beacon_base, entry->skb->data,
1569 entry->skb->len + padding_len); 1577 entry->skb->len + padding_len);