0053-wifi-ath11k-fix-writing-to-unintended-memory-region.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From 756a7f90878f0866fd2fe167ef37e90b47326b96 Mon Sep 17 00:00:00 2001
  2. From: P Praneesh <quic_ppranees@quicinc.com>
  3. Date: Fri, 24 Mar 2023 16:57:01 +0200
  4. Subject: [PATCH] wifi: ath11k: fix writing to unintended memory region
  5. While initializing spectral, the magic value is getting written to the
  6. invalid memory address leading to random boot-up crash. This occurs
  7. due to the incorrect index increment in ath11k_dbring_fill_magic_value
  8. function. Fix it by replacing the existing logic with memset32 to ensure
  9. there is no invalid memory access.
  10. Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01838-QCAHKSWPL_SILICONZ-1
  11. Fixes: d3d358efc553 ("ath11k: add spectral/CFR buffer validation support")
  12. Signed-off-by: P Praneesh <quic_ppranees@quicinc.com>
  13. Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
  14. Link: https://lore.kernel.org/r/20230321052900.16895-1-quic_ppranees@quicinc.com
  15. ---
  16. drivers/net/wireless/ath/ath11k/dbring.c | 12 ++++++------
  17. 1 file changed, 6 insertions(+), 6 deletions(-)
  18. --- a/drivers/net/wireless/ath/ath11k/dbring.c
  19. +++ b/drivers/net/wireless/ath/ath11k/dbring.c
  20. @@ -26,13 +26,13 @@ int ath11k_dbring_validate_buffer(struct
  21. static void ath11k_dbring_fill_magic_value(struct ath11k *ar,
  22. void *buffer, u32 size)
  23. {
  24. - u32 *temp;
  25. - int idx;
  26. + /* memset32 function fills buffer payload with the ATH11K_DB_MAGIC_VALUE
  27. + * and the variable size is expected to be the number of u32 values
  28. + * to be stored, not the number of bytes.
  29. + */
  30. + size = size / sizeof(u32);
  31. - size = size >> 2;
  32. -
  33. - for (idx = 0, temp = buffer; idx < size; idx++, temp++)
  34. - *temp++ = ATH11K_DB_MAGIC_VALUE;
  35. + memset32(buffer, ATH11K_DB_MAGIC_VALUE, size);
  36. }
  37. static int ath11k_dbring_bufs_replenish(struct ath11k *ar,