rtlwifi: rtl8188ee: rtl8821ae: Fix a queue locking problem
authorLarry Finger <Larry.Finger@lwfinger.net>
Fri, 26 Sep 2014 21:40:22 +0000 (16:40 -0500)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 30 Sep 2014 17:17:14 +0000 (13:17 -0400)
The code fails to lock the skb queue, which leads to a number of problems.
This patch also fixes a Sparse warning about using a memset of 1 byte.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: troy_tan@realsil.com.cn
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rtlwifi/rtl8188ee/fw.c
drivers/net/wireless/rtlwifi/rtl8188ee/hw.c
drivers/net/wireless/rtlwifi/rtl8821ae/fw.c

index eda6617da97fa253cd7dd0d6d07947a857042f31..8d4cf2edeed4815e87de2663d0abdf3eaae1f3df 100644 (file)
@@ -770,7 +770,7 @@ void rtl88e_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state)
        switch (p2p_ps_state) {
        case P2P_PS_DISABLE:
                RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_DISABLE\n");
-               memset(p2p_ps_offload, 0, 1);
+               memset(p2p_ps_offload, 0, sizeof(*p2p_ps_offload));
                break;
        case P2P_PS_ENABLE:
                RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_ENABLE\n");
index f74b7fb531c22cef17ef4d38b46c96da523dc468..f2b9713c456e14e8a89726ec989113a4635a1767 100644 (file)
@@ -89,7 +89,9 @@ static void _rtl88ee_return_beacon_queue_skb(struct ieee80211_hw *hw)
        struct rtl_priv *rtlpriv = rtl_priv(hw);
        struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
        struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[BEACON_QUEUE];
+       unsigned long flags;
 
+       spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags);
        while (skb_queue_len(&ring->queue)) {
                struct rtl_tx_desc *entry = &ring->desc[ring->idx];
                struct sk_buff *skb = __skb_dequeue(&ring->queue);
@@ -101,6 +103,7 @@ static void _rtl88ee_return_beacon_queue_skb(struct ieee80211_hw *hw)
                kfree_skb(skb);
                ring->idx = (ring->idx + 1) % ring->entries;
        }
+       spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags);
 }
 
 static void _rtl88ee_disable_bcn_sub_func(struct ieee80211_hw *hw)
index 6f71aaa76db746c745079c970ae44b404293b1b3..2efdb64d55289dd35f6e2bdcd81ec2167edf399d 100644 (file)
@@ -1757,7 +1757,7 @@ void rtl8821ae_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state)
        switch (p2p_ps_state) {
        case P2P_PS_DISABLE:
                RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_DISABLE\n");
-               memset(p2p_ps_offload, 0, 1);
+               memset(p2p_ps_offload, 0, sizeof(*p2p_ps_offload));
                break;
        case P2P_PS_ENABLE:
                RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_ENABLE\n");