Skip to content

Commit e9a78d9

Browse files
dmantipovgregkh
authored andcommitted
wifi: rtw88: always wait for both firmware loading attempts
[ Upstream commit 0e735a4 ] In 'rtw_wait_firmware_completion()', always wait for both (regular and wowlan) firmware loading attempts. Otherwise if 'rtw_usb_intf_init()' has failed in 'rtw_usb_probe()', 'rtw_usb_disconnect()' may issue 'ieee80211_free_hw()' when one of 'rtw_load_firmware_cb()' (usually the wowlan one) is still in progress, causing UAF detected by KASAN. Fixes: c8e5695 ("rtw88: load wowlan firmware if wowlan is supported") Reported-by: syzbot+6c6c08700f9480c41fe3@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=6c6c08700f9480c41fe3 Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20240726114657.25396-1-dmantipov@yandex.ru Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent afd165b commit e9a78d9

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • drivers/net/wireless/realtek/rtw88

drivers/net/wireless/realtek/rtw88/main.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,20 +1313,21 @@ static int rtw_wait_firmware_completion(struct rtw_dev *rtwdev)
13131313
{
13141314
const struct rtw_chip_info *chip = rtwdev->chip;
13151315
struct rtw_fw_state *fw;
1316+
int ret = 0;
13161317

13171318
fw = &rtwdev->fw;
13181319
wait_for_completion(&fw->completion);
13191320
if (!fw->firmware)
1320-
return -EINVAL;
1321+
ret = -EINVAL;
13211322

13221323
if (chip->wow_fw_name) {
13231324
fw = &rtwdev->wow_fw;
13241325
wait_for_completion(&fw->completion);
13251326
if (!fw->firmware)
1326-
return -EINVAL;
1327+
ret = -EINVAL;
13271328
}
13281329

1329-
return 0;
1330+
return ret;
13301331
}
13311332

13321333
static enum rtw_lps_deep_mode rtw_update_lps_deep_mode(struct rtw_dev *rtwdev,

0 commit comments

Comments
 (0)