staging: vt6655: [BUG] Protect MACvSelectPage1 with lock.
authorMalcolm Priestley <tvboxspy@gmail.com>
Sun, 11 Jan 2015 10:26:12 +0000 (10:26 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Jan 2015 03:45:35 +0000 (19:45 -0800)
The device must not flip to page 1 while in interrupt lock causing
loss of connection or dead lock.

Protect from changes to page by adding lock where user can
change the page in CARDvSetRSPINF, vnt_configure and set_channel

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6655/card.c
drivers/staging/vt6655/channel.c
drivers/staging/vt6655/device_main.c

index a0796405c308be6b36e1caae217ff92d860bb7b7..47801ca94cd99920d69253b18e7a4237f8d56c9e 100644 (file)
@@ -670,6 +670,9 @@ void CARDvSetRSPINF(struct vnt_private *pDevice, u8 bb_type)
 {
        union vnt_phy_field_swap phy;
        unsigned char byTxRate, byRsvTime;      /* For OFDM */
+       unsigned long flags;
+
+       spin_lock_irqsave(&pDevice->lock, flags);
 
        /* Set to Page1 */
        MACvSelectPage1(pDevice->PortOffset);
@@ -767,6 +770,8 @@ void CARDvSetRSPINF(struct vnt_private *pDevice, u8 bb_type)
        VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_72, MAKEWORD(byTxRate, byRsvTime));
        /* Set to Page0 */
        MACvSelectPage0(pDevice->PortOffset);
+
+       spin_unlock_irqrestore(&pDevice->lock, flags);
 }
 
 void CARDvUpdateBasicTopRate(struct vnt_private *pDevice)
index c8f739dd346eea7e4fc3287eb2eb5338955a1e46..983d9cbd34396f7c0ac3de8a3107ccfc164aec19 100644 (file)
@@ -202,6 +202,10 @@ bool set_channel(void *pDeviceHandler, unsigned int uConnectionChannel)
        BBvSoftwareReset(pDevice);
 
        if (pDevice->byLocalID > REV_ID_VT3253_B1) {
+               unsigned long flags;
+
+               spin_lock_irqsave(&pDevice->lock, flags);
+
                /* set HW default power register */
                MACvSelectPage1(pDevice->PortOffset);
                RFbSetPower(pDevice, RATE_1M, pDevice->byCurrentCh);
@@ -209,6 +213,8 @@ bool set_channel(void *pDeviceHandler, unsigned int uConnectionChannel)
                RFbSetPower(pDevice, RATE_6M, pDevice->byCurrentCh);
                VNSvOutPortB(pDevice->PortOffset + MAC_REG_PWROFDM, pDevice->byCurPwr);
                MACvSelectPage0(pDevice->PortOffset);
+
+               spin_unlock_irqrestore(&pDevice->lock, flags);
        }
 
        if (pDevice->byBBType == BB_TYPE_11B)
index a3f5cd84259ad81d556d8e77e72dcc3a89aecc9d..f5cc78e8254c647944d3d3db62ea79e3b483f360 100644 (file)
@@ -1565,6 +1565,10 @@ static void vnt_configure(struct ieee80211_hw *hw,
 
        if (changed_flags & FIF_ALLMULTI) {
                if (*total_flags & FIF_ALLMULTI) {
+                       unsigned long flags;
+
+                       spin_lock_irqsave(&priv->lock, flags);
+
                        if (priv->mc_list_count > 2) {
                                MACvSelectPage1(priv->PortOffset);
 
@@ -1586,6 +1590,8 @@ static void vnt_configure(struct ieee80211_hw *hw,
                                MACvSelectPage0(priv->PortOffset);
                        }
 
+                       spin_unlock_irqrestore(&priv->lock, flags);
+
                        rx_mode |= RCR_MULTICAST | RCR_BROADCAST;
                } else {
                        rx_mode &= ~(RCR_MULTICAST | RCR_BROADCAST);