Skip to content

Commit

Permalink
wifi: rtw88: unlock on error path in rtw_ops_add_interface()
Browse files Browse the repository at this point in the history
Call mutex_unlock(&rtwdev->mutex); before returning on this error path.

Fixes: f0e741e ("wifi: rtw88: add bitmap for dynamic port settings")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/ddd10a74-5982-4f65-8c59-c1cca558d239@kili.mountain
  • Loading branch information
Dan Carpenter authored and Kalle Valo committed May 11, 2023
1 parent 7acd695 commit e2ff118
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/wireless/realtek/rtw88/mac80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,10 @@ static int rtw_ops_add_interface(struct ieee80211_hw *hw,
mutex_lock(&rtwdev->mutex);

port = find_first_zero_bit(rtwdev->hw_port, RTW_PORT_NUM);
if (port >= RTW_PORT_NUM)
if (port >= RTW_PORT_NUM) {
mutex_unlock(&rtwdev->mutex);
return -EINVAL;
}
set_bit(port, rtwdev->hw_port);

rtwvif->port = port;
Expand Down

0 comments on commit e2ff118

Please sign in to comment.