[PATCH] wifi: ath9k_htc: fix the byte count of a full RMW buffer flush

Nerijus Bendžiūnas posted 1 patch 4 weeks, 1 day ago
There is a newer version of this series
drivers/net/wireless/ath/ath9k/htc_drv_init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] wifi: ath9k_htc: fix the byte count of a full RMW buffer flush
Posted by Nerijus Bendžiūnas 4 weeks, 1 day ago
ath9k_reg_rmw_buffer() sizes the WMI command with struct register_write
when it sends a buffer that has filled up, but the buffer holds struct
register_rmw entries, which are 12 bytes rather than 8. The firmware is
handed 120 bytes instead of 180 and applies only the first ten of the
fifteen queued read-modify-writes, silently dropping the rest.
ath9k_reg_rmw_flush() right below it already uses the correct type.

No caller is known to queue the full fifteen entries today, the closest
being ath9k_hw_4k_set_gain() at fourteen, so this is a latent bug rather
than an observed failure.

Fixes: 8badb50cfab6 ("ath9k_htc: add new WMI_REG_RMW_CMDID command")
Cc: stable@vger.kernel.org
Signed-off-by: Nerijus Bendžiūnas <nerijus.bendziunas@gmail.com>
---
 drivers/net/wireless/ath/ath9k/htc_drv_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index 6de78ae85726..0b49d2cc99f0 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -405,7 +405,7 @@ static void ath9k_reg_rmw_buffer(void *hw_priv,
 	if (priv->wmi->multi_rmw_idx == MAX_RMW_CMD_NUMBER) {
 		r = ath9k_wmi_cmd(priv->wmi, WMI_REG_RMW_CMDID,
 			  (u8 *) &priv->wmi->multi_rmw,
-			  sizeof(struct register_write) * priv->wmi->multi_rmw_idx,
+			  sizeof(struct register_rmw) * priv->wmi->multi_rmw_idx,
 			  (u8 *) &rsp_status, sizeof(rsp_status),
 			  100);
 		if (unlikely(r)) {
-- 
2.55.0