Message ID | ddd10a74-5982-4f65-8c59-c1cca558d239@kili.mountain (mailing list archive) |
---|---|
State | Accepted |
Commit | e2ff1181b3d48257aab26bfd2165f3c7d271499f |
Delegated to: | Kalle Valo |
Headers | show |
Series | wifi: rtw88: unlock on error path in rtw_ops_add_interface() | expand |
> -----Original Message----- > From: Dan Carpenter <dan.carpenter@linaro.org> > Sent: Wednesday, May 3, 2023 11:10 PM > To: Bernie Huang <phhuang@realtek.com> > Cc: Yan-Hsuan Chuang <tony0620emma@gmail.com>; Kalle Valo <kvalo@kernel.org>; Ping-Ke Shih > <pkshih@realtek.com>; linux-wireless@vger.kernel.org; kernel-janitors@vger.kernel.org > Subject: [PATCH] wifi: rtw88: unlock on error path in rtw_ops_add_interface() > > Call mutex_unlock(&rtwdev->mutex); before returning on this error path. > > Fixes: f0e741e4ddbc ("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> [...]
Dan Carpenter <dan.carpenter@linaro.org> wrote: > Call mutex_unlock(&rtwdev->mutex); before returning on this error path. > > Fixes: f0e741e4ddbc ("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> Patch applied to wireless-next.git, thanks. e2ff1181b3d4 wifi: rtw88: unlock on error path in rtw_ops_add_interface()
diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c index 7aa6edad0d01..02cd19ee6e4c 100644 --- a/drivers/net/wireless/realtek/rtw88/mac80211.c +++ b/drivers/net/wireless/realtek/rtw88/mac80211.c @@ -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;
Call mutex_unlock(&rtwdev->mutex); before returning on this error path. Fixes: f0e741e4ddbc ("wifi: rtw88: add bitmap for dynamic port settings") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> --- drivers/net/wireless/realtek/rtw88/mac80211.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)