Commit f4d6082d authored by Tomas Winkler's avatar Tomas Winkler Committed by John W. Linville

iwlwifi: fix locking unbalance in 4965 rate scale

This patch fixes locking unbalance after adding rcu locking
for sta
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 6c5ef8a7
...@@ -852,19 +852,18 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev, ...@@ -852,19 +852,18 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
sta = sta_info_get(local, hdr->addr1); sta = sta_info_get(local, hdr->addr1);
if (!sta || !sta->rate_ctrl_priv) { if (!sta || !sta->rate_ctrl_priv)
rcu_read_unlock(); goto out;
return;
}
lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv;
if (!priv->lq_mngr.lq_ready) if (!priv->lq_mngr.lq_ready)
return; goto out;
if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) &&
!lq_sta->ibss_sta_added) !lq_sta->ibss_sta_added)
return; goto out;
table = &lq_sta->lq; table = &lq_sta->lq;
active_index = lq_sta->active_tbl; active_index = lq_sta->active_tbl;
...@@ -915,8 +914,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev, ...@@ -915,8 +914,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
tx_resp->control.tx_rate->bitrate)) { tx_resp->control.tx_rate->bitrate)) {
IWL_DEBUG_RATE("initial rate does not match 0x%x\n", IWL_DEBUG_RATE("initial rate does not match 0x%x\n",
tx_mcs.rate_n_flags); tx_mcs.rate_n_flags);
rcu_read_unlock(); goto out;
return;
} }
/* Update frame history window with "failure" for each Tx retry. */ /* Update frame history window with "failure" for each Tx retry. */
...@@ -1025,6 +1023,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev, ...@@ -1025,6 +1023,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
/* See if there's a better rate or modulation mode to try. */ /* See if there's a better rate or modulation mode to try. */
rs_rate_scale_perform(priv, dev, hdr, sta); rs_rate_scale_perform(priv, dev, hdr, sta);
out:
rcu_read_unlock(); rcu_read_unlock();
return; return;
} }
...@@ -2229,8 +2228,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, ...@@ -2229,8 +2228,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) || if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) ||
!sta || !sta->rate_ctrl_priv) { !sta || !sta->rate_ctrl_priv) {
sel->rate = rate_lowest(local, sband, sta); sel->rate = rate_lowest(local, sband, sta);
rcu_read_unlock(); goto out;
return;
} }
lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv;
...@@ -2257,14 +2255,15 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, ...@@ -2257,14 +2255,15 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
goto done; goto done;
} }
done: done:
if ((i < 0) || (i > IWL_RATE_COUNT)) { if ((i < 0) || (i > IWL_RATE_COUNT)) {
sel->rate = rate_lowest(local, sband, sta); sel->rate = rate_lowest(local, sband, sta);
return; goto out;
} }
rcu_read_unlock();
sel->rate = &priv->ieee_rates[i]; sel->rate = &priv->ieee_rates[i];
out:
rcu_read_unlock();
} }
static void *rs_alloc_sta(void *priv, gfp_t gfp) static void *rs_alloc_sta(void *priv, gfp_t gfp)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment