|
|
56e3f4 |
From 4d6f3cdaef718e0b5e15bf36fc8d9c3740218996 Mon Sep 17 00:00:00 2001
|
|
|
56e3f4 |
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
|
|
56e3f4 |
Date: Fri, 21 Jan 2022 08:49:02 +0100
|
|
|
56e3f4 |
Subject: [PATCH 10/36] rtw89: update partition size of firmware header on
|
|
|
56e3f4 |
skb->data
|
|
|
56e3f4 |
MIME-Version: 1.0
|
|
|
56e3f4 |
Content-Type: text/plain; charset=UTF-8
|
|
|
56e3f4 |
Content-Transfer-Encoding: 8bit
|
|
|
56e3f4 |
|
|
|
56e3f4 |
Bugzilla: http://bugzilla.redhat.com/2033291
|
|
|
56e3f4 |
|
|
|
56e3f4 |
commit 5737b4515deea0829c138ab5201160345ec67d49
|
|
|
56e3f4 |
Author: Ping-Ke Shih <pkshih@realtek.com>
|
|
|
56e3f4 |
Date: Fri Nov 19 13:45:10 2021 +0800
|
|
|
56e3f4 |
|
|
|
56e3f4 |
rtw89: update partition size of firmware header on skb->data
|
|
|
56e3f4 |
|
|
|
56e3f4 |
The partition size is used to tell hardware the size of piece we are going
|
|
|
56e3f4 |
to send a firmware. The old code updates the size in constant buffer of
|
|
|
56e3f4 |
firmware, and leads system crash.
|
|
|
56e3f4 |
|
|
|
56e3f4 |
To fix this, update the size on skb->data after we copy the firmware data
|
|
|
56e3f4 |
into skb.
|
|
|
56e3f4 |
|
|
|
56e3f4 |
Buglink: https://bugzilla.opensuse.org/show_bug.cgi?id=1188303
|
|
|
56e3f4 |
Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver")
|
|
|
56e3f4 |
Reported-by: Takashi Iwai <tiwai@suse.de>
|
|
|
56e3f4 |
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
|
|
56e3f4 |
Tested-by: Takashi Iwai <tiwai@suse.de>
|
|
|
56e3f4 |
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
|
|
|
56e3f4 |
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
|
|
|
56e3f4 |
Link: https://lore.kernel.org/r/20211119054512.10620-2-pkshih@realtek.com
|
|
|
56e3f4 |
|
|
|
56e3f4 |
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
|
|
56e3f4 |
---
|
|
|
56e3f4 |
drivers/net/wireless/realtek/rtw89/fw.c | 2 +-
|
|
|
56e3f4 |
drivers/net/wireless/realtek/rtw89/fw.h | 6 ++++--
|
|
|
56e3f4 |
2 files changed, 5 insertions(+), 3 deletions(-)
|
|
|
56e3f4 |
|
|
|
56e3f4 |
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
|
|
|
56e3f4 |
index 212aaf577d3c..65ef3dc9d061 100644
|
|
|
56e3f4 |
--- a/drivers/net/wireless/realtek/rtw89/fw.c
|
|
|
56e3f4 |
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
|
|
|
56e3f4 |
@@ -91,7 +91,6 @@ static int rtw89_fw_hdr_parser(struct rtw89_dev *rtwdev, const u8 *fw, u32 len,
|
|
|
56e3f4 |
info->section_num = GET_FW_HDR_SEC_NUM(fw);
|
|
|
56e3f4 |
info->hdr_len = RTW89_FW_HDR_SIZE +
|
|
|
56e3f4 |
info->section_num * RTW89_FW_SECTION_HDR_SIZE;
|
|
|
56e3f4 |
- SET_FW_HDR_PART_SIZE(fw, FWDL_SECTION_PER_PKT_LEN);
|
|
|
56e3f4 |
|
|
|
56e3f4 |
bin = fw + info->hdr_len;
|
|
|
56e3f4 |
|
|
|
56e3f4 |
@@ -275,6 +274,7 @@ static int __rtw89_fw_download_hdr(struct rtw89_dev *rtwdev, const u8 *fw, u32 l
|
|
|
56e3f4 |
}
|
|
|
56e3f4 |
|
|
|
56e3f4 |
skb_put_data(skb, fw, len);
|
|
|
56e3f4 |
+ SET_FW_HDR_PART_SIZE(skb->data, FWDL_SECTION_PER_PKT_LEN);
|
|
|
56e3f4 |
rtw89_h2c_pkt_set_hdr_fwdl(rtwdev, skb, FWCMD_TYPE_H2C,
|
|
|
56e3f4 |
H2C_CAT_MAC, H2C_CL_MAC_FWDL,
|
|
|
56e3f4 |
H2C_FUNC_MAC_FWHDR_DL, len);
|
|
|
56e3f4 |
diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h
|
|
|
56e3f4 |
index 7ee0d9323310..36e8d0da6c1e 100644
|
|
|
56e3f4 |
--- a/drivers/net/wireless/realtek/rtw89/fw.h
|
|
|
56e3f4 |
+++ b/drivers/net/wireless/realtek/rtw89/fw.h
|
|
|
56e3f4 |
@@ -282,8 +282,10 @@ struct rtw89_h2creg_sch_tx_en {
|
|
|
56e3f4 |
le32_get_bits(*((__le32 *)(fwhdr) + 6), GENMASK(15, 8))
|
|
|
56e3f4 |
#define GET_FW_HDR_CMD_VERSERION(fwhdr) \
|
|
|
56e3f4 |
le32_get_bits(*((__le32 *)(fwhdr) + 7), GENMASK(31, 24))
|
|
|
56e3f4 |
-#define SET_FW_HDR_PART_SIZE(fwhdr, val) \
|
|
|
56e3f4 |
- le32p_replace_bits((__le32 *)(fwhdr) + 7, val, GENMASK(15, 0))
|
|
|
56e3f4 |
+static inline void SET_FW_HDR_PART_SIZE(void *fwhdr, u32 val)
|
|
|
56e3f4 |
+{
|
|
|
56e3f4 |
+ le32p_replace_bits((__le32 *)fwhdr + 7, val, GENMASK(15, 0));
|
|
|
56e3f4 |
+}
|
|
|
56e3f4 |
|
|
|
56e3f4 |
#define SET_CTRL_INFO_MACID(table, val) \
|
|
|
56e3f4 |
le32p_replace_bits((__le32 *)(table) + 0, val, GENMASK(6, 0))
|
|
|
56e3f4 |
--
|
|
|
56e3f4 |
2.13.6
|
|
|
56e3f4 |
|