Skip to contentSkip to conversation

iwlwifi: missing unlock on error path

PATCH In review Dan Carpenter 2 participants 2 messages Mar 15, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 iwlwifi: missing unlock on error path

We should unlock here instead of returning -EINVAL directly.

drivers/net/wireless/iwlwifi/iwl-agn.c +5 -2
index 581dc9f..321b18b 100644
@@ -3009,14 +3009,17 @@ static int iwl_mac_offchannel_tx_cancel_wait(struct ieee80211_hw *hw)
 
 	mutex_lock(&priv->mutex);
 
-	if (!priv->_agn.offchan_tx_skb)
-		return -EINVAL;
+	if (!priv->_agn.offchan_tx_skb) {
+		ret = -EINVAL;
+		goto unlock;
+	}
 
 	priv->_agn.offchan_tx_skb = NULL;
 
 	ret = iwl_scan_cancel_timeout(priv, 200);
 	if (ret)
 		ret = -EIO;
+unlock:
 	mutex_unlock(&priv->mutex);
 
 	return ret;
#1 lore raw
Quoted 19 lines · Dan Carpenter

We should unlock here instead of returning -EINVAL directly.

drivers/net/wireless/iwlwifi/iwl-agn.c +4 -2
index 581dc9f..321b18b 100644
@@ -3009,14 +3009,17 @@ static int iwl_mac_offchannel_tx_cancel_wait(struct ieee80211_hw *hw)
 
 	mutex_lock(&priv->mutex);
 
-	if (!priv->_agn.offchan_tx_skb)
-		return -EINVAL;
+	if (!priv->_agn.offchan_tx_skb) {
+		ret = -EINVAL;
+		goto unlock;
+	}

drivers/net/wireless/iwlwifi/iwl-agn.c static int iwl_mac_offchannel_tx_cancel_wait(struct ieee80211_hw *hw) · line 3025

Quoted 10 lines
drivers/net/wireless/iwlwifi/iwl-agn.c +1 -0
 
 	priv->_agn.offchan_tx_skb = NULL;
 
 	ret = iwl_scan_cancel_timeout(priv, 200);
 	if (ret)
 		ret = -EIO;
+unlock:
 	mutex_unlock(&priv->mutex);
 
 	return ret;

great catch

Thanks
Wey