aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ti
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2014-07-10 20:01:38 -0400
committerJohn W. Linville <linville@tuxdriver.com>2014-07-15 16:00:02 -0400
commit9bccb8ae054fda9ab51e3291eeee545ecc1f1854 (patch)
treec96664867e3bf9c731007b7d8e339e57726ee1b7 /drivers/net/wireless/ti
parent1631020226ee6a95d1d9ff64562c5da1113ff77f (diff)
wl18xx: make sure fw_status->priv exists before deref
In some corner cases with specific timings, we might try dequeueing tx before we got information about the link status (e.g. due to recovery during tx). Instead of NULL dereference, assume all the links in this case have low priorities. Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ti')
-rw-r--r--drivers/net/wireless/ti/wl18xx/main.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c
index 4422ecf0e726..edc3e4d8966d 100644
--- a/drivers/net/wireless/ti/wl18xx/main.c
+++ b/drivers/net/wireless/ti/wl18xx/main.c
@@ -1609,9 +1609,14 @@ static bool wl18xx_lnk_high_prio(struct wl1271 *wl, u8 hlid,
1609 u8 thold; 1609 u8 thold;
1610 struct wl18xx_fw_status_priv *status_priv = 1610 struct wl18xx_fw_status_priv *status_priv =
1611 (struct wl18xx_fw_status_priv *)wl->fw_status->priv; 1611 (struct wl18xx_fw_status_priv *)wl->fw_status->priv;
1612 u32 suspend_bitmap = le32_to_cpu(status_priv->link_suspend_bitmap); 1612 u32 suspend_bitmap;
1613
1614 /* if we don't have the link map yet, assume they all low prio */
1615 if (!status_priv)
1616 return false;
1613 1617
1614 /* suspended links are never high priority */ 1618 /* suspended links are never high priority */
1619 suspend_bitmap = le32_to_cpu(status_priv->link_suspend_bitmap);
1615 if (test_bit(hlid, (unsigned long *)&suspend_bitmap)) 1620 if (test_bit(hlid, (unsigned long *)&suspend_bitmap))
1616 return false; 1621 return false;
1617 1622
@@ -1631,8 +1636,13 @@ static bool wl18xx_lnk_low_prio(struct wl1271 *wl, u8 hlid,
1631 u8 thold; 1636 u8 thold;
1632 struct wl18xx_fw_status_priv *status_priv = 1637 struct wl18xx_fw_status_priv *status_priv =
1633 (struct wl18xx_fw_status_priv *)wl->fw_status->priv; 1638 (struct wl18xx_fw_status_priv *)wl->fw_status->priv;
1634 u32 suspend_bitmap = le32_to_cpu(status_priv->link_suspend_bitmap); 1639 u32 suspend_bitmap;
1640
1641 /* if we don't have the link map yet, assume they all low prio */
1642 if (!status_priv)
1643 return true;
1635 1644
1645 suspend_bitmap = le32_to_cpu(status_priv->link_suspend_bitmap);
1636 if (test_bit(hlid, (unsigned long *)&suspend_bitmap)) 1646 if (test_bit(hlid, (unsigned long *)&suspend_bitmap))
1637 thold = status_priv->tx_suspend_threshold; 1647 thold = status_priv->tx_suspend_threshold;
1638 else if (test_bit(hlid, (unsigned long *)&wl->fw_fast_lnk_map) && 1648 else if (test_bit(hlid, (unsigned long *)&wl->fw_fast_lnk_map) &&