Commit 0270639e authored by Dan Carpenter's avatar Dan Carpenter Committed by Kalle Valo

rsi: missing unlocks on error paths

There is a missing unlock if rsi_find_sta() fails in
rsi_mac80211_ampdu_action() or if we hit the -EINVAL path in
rsi_mac80211_sta_add().

Fixes: 3528608f ("rsi: handle station connection in AP mode")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent fc438672
...@@ -906,7 +906,8 @@ static int rsi_mac80211_ampdu_action(struct ieee80211_hw *hw, ...@@ -906,7 +906,8 @@ static int rsi_mac80211_ampdu_action(struct ieee80211_hw *hw,
rsta = rsi_find_sta(common, sta->addr); rsta = rsi_find_sta(common, sta->addr);
if (!rsta) { if (!rsta) {
rsi_dbg(ERR_ZONE, "No station mapped\n"); rsi_dbg(ERR_ZONE, "No station mapped\n");
return 0; status = 0;
goto unlock;
} }
sta_id = rsta->sta_id; sta_id = rsta->sta_id;
} }
...@@ -974,6 +975,7 @@ static int rsi_mac80211_ampdu_action(struct ieee80211_hw *hw, ...@@ -974,6 +975,7 @@ static int rsi_mac80211_ampdu_action(struct ieee80211_hw *hw,
break; break;
} }
unlock:
mutex_unlock(&common->mutex); mutex_unlock(&common->mutex);
return status; return status;
} }
...@@ -1202,6 +1204,7 @@ static int rsi_mac80211_sta_add(struct ieee80211_hw *hw, ...@@ -1202,6 +1204,7 @@ static int rsi_mac80211_sta_add(struct ieee80211_hw *hw,
struct rsi_common *common = adapter->priv; struct rsi_common *common = adapter->priv;
bool sta_exist = false; bool sta_exist = false;
struct rsi_sta *rsta; struct rsi_sta *rsta;
int status = 0;
rsi_dbg(INFO_ZONE, "Station Add: %pM\n", sta->addr); rsi_dbg(INFO_ZONE, "Station Add: %pM\n", sta->addr);
...@@ -1215,8 +1218,8 @@ static int rsi_mac80211_sta_add(struct ieee80211_hw *hw, ...@@ -1215,8 +1218,8 @@ static int rsi_mac80211_sta_add(struct ieee80211_hw *hw,
/* Check if max stations reached */ /* Check if max stations reached */
if (common->num_stations >= common->max_stations) { if (common->num_stations >= common->max_stations) {
rsi_dbg(ERR_ZONE, "Reject: Max Stations exists\n"); rsi_dbg(ERR_ZONE, "Reject: Max Stations exists\n");
mutex_unlock(&common->mutex); status = -EOPNOTSUPP;
return -EOPNOTSUPP; goto unlock;
} }
for (cnt = 0; cnt < common->max_stations; cnt++) { for (cnt = 0; cnt < common->max_stations; cnt++) {
rsta = &common->stations[cnt]; rsta = &common->stations[cnt];
...@@ -1241,7 +1244,8 @@ static int rsi_mac80211_sta_add(struct ieee80211_hw *hw, ...@@ -1241,7 +1244,8 @@ static int rsi_mac80211_sta_add(struct ieee80211_hw *hw,
rsi_dbg(ERR_ZONE, rsi_dbg(ERR_ZONE,
"%s: Some problem reaching here...\n", "%s: Some problem reaching here...\n",
__func__); __func__);
return -EINVAL; status = -EINVAL;
goto unlock;
} }
rsta = &common->stations[sta_idx]; rsta = &common->stations[sta_idx];
rsta->sta = sta; rsta->sta = sta;
...@@ -1289,9 +1293,10 @@ static int rsi_mac80211_sta_add(struct ieee80211_hw *hw, ...@@ -1289,9 +1293,10 @@ static int rsi_mac80211_sta_add(struct ieee80211_hw *hw,
} }
} }
unlock:
mutex_unlock(&common->mutex); mutex_unlock(&common->mutex);
return 0; return status;
} }
/** /**
......
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