Skip to contentSkip to conversation

staging: vt6656: [bug] Fix missing spin lock in iwctl_siwpower.

PATCH Superseded Malcolm Priestley 1 participant 2 messages May 14, 2013 – May 15, 2013 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: vt6656: [bug] Fix missing spin lock in iwctl_siwpower.

Fixes occasional dead lock on power up / down.

Only relevant to kernels 3.8 and later when command was transferred to the iw_handler.

---
 drivers/staging/vt6656/iwctl.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/staging/vt6656/iwctl.c +7 -0
index c335808..855eb58 100644
@@ -1334,6 +1334,7 @@ int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info,
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
 	struct iw_param *wrq = &wrqu->power;
 	int rc = 0;
+	unsigned long flags;
 
 	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER\n");
 
@@ -1345,9 +1346,12 @@ int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info,
 		return rc;
 	}
 
+	spin_lock_irqsave(&pDevice->lock, flags);
+
 	if (wrq->disabled) {
 		pDevice->ePSMode = WMAC_POWER_CAM;
 		PSvDisablePowerSaving(pDevice);
+		spin_unlock_irqrestore(&pDevice->lock, flags);
 		return rc;
 	}
 	if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
@@ -1358,6 +1362,9 @@ int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info,
 		pDevice->ePSMode = WMAC_POWER_FAST;
 		PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval);
 	}
+
+	spin_unlock_irqrestore(&pDevice->lock, flags);
+
 	switch (wrq->flags & IW_POWER_MODE) {
 	case IW_POWER_UNICAST_R:
 		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R \n");
Signature · 1 line
1.8.1.2
#1 lore raw
Quoted 5 lines · Malcolm Priestley

Fixes occasional dead lock on power up / down.

Only relevant to kernels 3.8 and later when command was transferred to the iw_handler.

Please ignore this patch, I will redo, I shouldn't have used spin_lock_irqsave.

Malcolm