CVE-2024-40979

In the Linux kernel, the following vulnerability has been resolved: wifi: ath12k: fix kernel crash during resume Currently during resume, QMI target memory is not properly handled, resulting in kernel crash in case DMA remap is not supported: BUG: Bad page state in process kworker/u16:54 pfn:36e80 page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x36e80 page dumped because: nonzero _refcount Call Trace: bad_page free_page_is_bad_report __free_pages_ok __free_pages dma_direct_free dma_free_attrs ath12k_qmi_free_target_mem_chunk ath12k_qmi_msg_mem_request_cb The reason is: Once ath12k module is loaded, firmware sends memory request to host. In case DMA remap not supported, ath12k refuses the first request due to failure in allocating with large segment size: ath12k_pci 0000:04:00.0: qmi firmware request memory request ath12k_pci 0000:04:00.0: qmi mem seg type 1 size 7077888 ath12k_pci 0000:04:00.0: qmi mem seg type 4 size 8454144 ath12k_pci 0000:04:00.0: qmi dma allocation failed (7077888 B type 1), will try later with small size ath12k_pci 0000:04:00.0: qmi delays mem_request 2 ath12k_pci 0000:04:00.0: qmi firmware request memory request Later firmware comes back with more but small segments and allocation succeeds: ath12k_pci 0000:04:00.0: qmi mem seg type 1 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 1 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 1 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 1 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 1 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 1 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 1 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 1 size 262144 ath12k_pci 0000:04:00.0: qmi mem seg type 1 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 1 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 1 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 1 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 1 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 4 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 4 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 4 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 4 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 4 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 4 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 4 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 4 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 4 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 4 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 4 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 4 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 4 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 4 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 4 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 4 size 524288 ath12k_pci 0000:04:00.0: qmi mem seg type 4 size 65536 ath12k_pci 0000:04:00.0: qmi mem seg type 1 size 524288 Now ath12k is working. If suspend is triggered, firmware will be reloaded during resume. As same as before, firmware requests two large segments at first. In ath12k_qmi_msg_mem_request_cb() segment count and size are assigned: ab->qmi.mem_seg_count == 2 ab->qmi.target_mem[0].size == 7077888 ab->qmi.target_mem[1].size == 8454144 Then allocation failed like before and ath12k_qmi_free_target_mem_chunk() is called to free all allocated segments. Note the first segment is skipped because its v.addr is cleared due to allocation failure: chunk->v.addr = dma_alloc_coherent() Also note that this leaks that segment because it has not been freed. While freeing the second segment, a size of 8454144 is passed to dma_free_coherent(). However remember that this segment is allocated at the first time firmware is loaded, before suspend. So its real size is 524288, much smaller than 8454144. As a result kernel found we are freeing some memory which is in use and thus cras ---truncated---
Configurations

Configuration 1 (hide)

cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*

History

17 Sep 2025, 14:57

Type Values Removed Values Added
CVSS v2 : unknown
v3 : unknown
v2 : unknown
v3 : 5.5
CPE cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
CWE CWE-401
CWE-763
First Time Linux
Linux linux Kernel
References () https://git.kernel.org/stable/c/303c017821d88ebad887814114d4e5966d320b28 - () https://git.kernel.org/stable/c/303c017821d88ebad887814114d4e5966d320b28 - Patch
References () https://git.kernel.org/stable/c/bb50a4e711ff95348ad53641acb1306d89eb4c3a - () https://git.kernel.org/stable/c/bb50a4e711ff95348ad53641acb1306d89eb4c3a - Patch

21 Nov 2024, 09:31

Type Values Removed Values Added
References () https://git.kernel.org/stable/c/303c017821d88ebad887814114d4e5966d320b28 - () https://git.kernel.org/stable/c/303c017821d88ebad887814114d4e5966d320b28 -
References () https://git.kernel.org/stable/c/bb50a4e711ff95348ad53641acb1306d89eb4c3a - () https://git.kernel.org/stable/c/bb50a4e711ff95348ad53641acb1306d89eb4c3a -
Summary
  • (es) En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: wifi: ath12k: soluciona el fallo del kernel durante la reanudación Actualmente, durante la reanudación, la memoria de destino de QMI no se maneja adecuadamente, lo que provoca un fallo del kernel en caso de que no se admita la reasignación de DMA: ERROR: Estado incorrecto de la página en proceso kworker/u16:54 pfn:36e80 página: refcount:1 mapcount:0 mapeo:0000000000000000 index:0x0 pfn:0x36e80 página descargada porque: distinto de cero _refcount Rastreo de llamadas: bad_page free_page_is_bad_report __free_pages_ok __free_pages dma_direct_free dma_free_attrs a th12k_qmi_free_target_mem_chunk ath12k_qmi_msg_mem_request_cb El motivo es: Una vez ath12k El módulo está cargado, el firmware envía la solicitud de memoria al host. En caso de que no se admita la reasignación de DMA, ath12k rechaza la primera solicitud debido a un error en la asignación con un tamaño de segmento grande: ath12k_pci 0000:04:00.0: solicitud de firmware qmi solicitud de memoria ath12k_pci 0000:04:00.0: qmi mem seg tipo 1 tamaño 7077888 ath12k_pci 0000 :04:00.0: qmi mem seg tipo 4 tamaño 8454144 ath12k_pci 0000:04:00.0: falla en la asignación de qmi dma (7077888 B tipo 1), lo intentaré más tarde con un tamaño pequeño ath12k_pci 0000:04:00.0: qmi retrasa mem_request 2 ath12k_pci 0000: 04:00.0: solicitud de memoria de solicitud de firmware qmi El firmware posterior regresa con más segmentos, pero pequeños, y la asignación se realiza correctamente: ath12k_pci 0000:04:00.0: qmi mem seg tipo 1 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 1 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 1 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 1 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 1 tamaño 524288 pci 0000:04:00.0:qmi mem seg tipo 1 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 1 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 1 tamaño 262144 ath12k_pci 0000:04:00.0: qmi mem seg tipo 1 tamaño 524288 ath12k_pci 0000 :04:00.0: qmi mem seg tipo 1 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 1 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 1 tamaño 524288 ath12k_pci 0000:04:00 .0: segmento de memoria qmi tipo 1 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 4 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 4 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 4 tamaño 24288 ath12k_pci 0000:04 :00.0: qmi mem seg tipo 4 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 4 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 4 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 4 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 4 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 4 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 4 tamaño 5242 88 ath12k_pci 0000:04:00.0 : qmi mem seg tipo 4 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 4 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 4 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem se g tipo 4 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 4 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 4 tamaño 524288 ath12k_pci 0000:04:00.0: qmi mem seg tipo 4 tamaño 65536 ci 0000:04:00.0: qmi mem seg tipo 1 tamaño 524288 Ahora ath12k está funcionando. Si se activa la suspensión, el firmware se recargará durante la reanudación. Al igual que antes, el firmware solicita dos segmentos grandes al principio. En ath12k_qmi_msg_mem_request_cb() se asigna el recuento y el tamaño del segmento: ab->qmi.mem_seg_count == 2 ab->qmi.target_mem[0].size == 7077888 ab->qmi.target_mem[1].size == 8454144 Luego, la asignación falló como antes y se llama a ath12k_qmi_free_target_mem_chunk() para liberar todos los segmentos asignados. ---truncado---

12 Jul 2024, 16:34

Type Values Removed Values Added
New CVE

Information

Published : 2024-07-12 13:15

Updated : 2025-09-17 14:57


NVD link : CVE-2024-40979

Mitre link : CVE-2024-40979

CVE.ORG link : CVE-2024-40979


JSON object : View

Products Affected

linux

  • linux_kernel
CWE
CWE-401

Missing Release of Memory after Effective Lifetime

CWE-763

Release of Invalid Pointer or Reference