]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: ath12k: fix endianness handling while accessing wmi service bit
authorTamizh Chelvam Raja <tamizh.raja@oss.qualcomm.com>
Thu, 17 Jul 2025 17:35:38 +0000 (23:05 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Aug 2025 10:13:45 +0000 (12:13 +0200)
[ Upstream commit 8f1a078842d4af4877fb686f3907788024d0d1b7 ]

Currently there is no endian conversion in ath12k_wmi_tlv_services_parser()
so the service bit parsing will be incorrect on a big endian platform and
to fix this by using appropriate endian conversion.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00217-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Fixes: 342527f35338 ("wifi: ath12k: Add support to parse new WMI event for 6 GHz regulatory")
Signed-off-by: Tamizh Chelvam Raja <tamizh.raja@oss.qualcomm.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20250717173539.2523396-2-tamizh.raja@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/ath/ath12k/wmi.c

index 5c2130f77dac66ef24414125cdab4883031f306e..d5892e17494f7df75d144bee94aa2c3272becff2 100644 (file)
@@ -6589,7 +6589,7 @@ static int ath12k_wmi_tlv_services_parser(struct ath12k_base *ab,
                                          void *data)
 {
        const struct wmi_service_available_event *ev;
-       u32 *wmi_ext2_service_bitmap;
+       __le32 *wmi_ext2_service_bitmap;
        int i, j;
        u16 expected_len;
 
@@ -6621,12 +6621,12 @@ static int ath12k_wmi_tlv_services_parser(struct ath12k_base *ab,
                           ev->wmi_service_segment_bitmap[3]);
                break;
        case WMI_TAG_ARRAY_UINT32:
-               wmi_ext2_service_bitmap = (u32 *)ptr;
+               wmi_ext2_service_bitmap = (__le32 *)ptr;
                for (i = 0, j = WMI_MAX_EXT_SERVICE;
                     i < WMI_SERVICE_SEGMENT_BM_SIZE32 && j < WMI_MAX_EXT2_SERVICE;
                     i++) {
                        do {
-                               if (wmi_ext2_service_bitmap[i] &
+                               if (__le32_to_cpu(wmi_ext2_service_bitmap[i]) &
                                    BIT(j % WMI_AVAIL_SERVICE_BITS_IN_SIZE32))
                                        set_bit(j, ab->wmi_ab.svc_map);
                        } while (++j % WMI_AVAIL_SERVICE_BITS_IN_SIZE32);
@@ -6634,8 +6634,10 @@ static int ath12k_wmi_tlv_services_parser(struct ath12k_base *ab,
 
                ath12k_dbg(ab, ATH12K_DBG_WMI,
                           "wmi_ext2_service_bitmap 0x%04x 0x%04x 0x%04x 0x%04x",
-                          wmi_ext2_service_bitmap[0], wmi_ext2_service_bitmap[1],
-                          wmi_ext2_service_bitmap[2], wmi_ext2_service_bitmap[3]);
+                          __le32_to_cpu(wmi_ext2_service_bitmap[0]),
+                          __le32_to_cpu(wmi_ext2_service_bitmap[1]),
+                          __le32_to_cpu(wmi_ext2_service_bitmap[2]),
+                          __le32_to_cpu(wmi_ext2_service_bitmap[3]));
                break;
        }
        return 0;