* [PATCH v4 0/2] wifi: ath12k: fix issues when unbinding
@ 2024-10-17 18:07 Jose Ignacio Tornos Martinez
2024-10-17 18:07 ` [PATCH v4 1/2] wifi: ath12k: fix crash " Jose Ignacio Tornos Martinez
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jose Ignacio Tornos Martinez @ 2024-10-17 18:07 UTC (permalink / raw)
To: kvalo, jjohnson, linux-wireless, ath12k, linux-kernel; +Cc: jtornosm
wifi: ath12k: fix issues when unbinding
Currently, ath12k driver is not working from VMs but it cannot be unbinded
either from there. I would like to send these patches to fix the issues that
I have found in order to get the unbind operation working there, at least to
fix the errors found during the process when the initial error is detected.
Just FYI and out of the scope of these patches, I am unbinding and binding
to apply a workaround with an extra module to fix the MSI addressing by
means of kprobes to be able to work with this device from VMs.
Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v4 1/2] wifi: ath12k: fix crash when unbinding
2024-10-17 18:07 [PATCH v4 0/2] wifi: ath12k: fix issues when unbinding Jose Ignacio Tornos Martinez
@ 2024-10-17 18:07 ` Jose Ignacio Tornos Martinez
2024-10-17 18:07 ` [PATCH v4 2/2] wifi: ath12k: fix warning " Jose Ignacio Tornos Martinez
2024-10-22 15:01 ` [PATCH v4 0/2] wifi: ath12k: fix issues " Jeff Johnson
2 siblings, 0 replies; 4+ messages in thread
From: Jose Ignacio Tornos Martinez @ 2024-10-17 18:07 UTC (permalink / raw)
To: kvalo, jjohnson, linux-wireless, ath12k, linux-kernel; +Cc: jtornosm, stable
If there is an error during some initialization related to firmware,
the function ath12k_dp_cc_cleanup is called to release resources.
However this is released again when the device is unbinded (ath12k_pci),
and we get:
BUG: kernel NULL pointer dereference, address: 0000000000000020
at RIP: 0010:ath12k_dp_cc_cleanup.part.0+0xb6/0x500 [ath12k]
Call Trace:
ath12k_dp_cc_cleanup
ath12k_dp_free
ath12k_core_deinit
ath12k_pci_remove
...
The issue is always reproducible from a VM because the MSI addressing
initialization is failing.
In order to fix the issue, just set to NULL the released structure in
ath12k_dp_cc_cleanup at the end.
cc: stable@vger.kernel.org
Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
---
v4:
- Send with cover letter to get reference with 2/2
v3: https://lore.kernel.org/linux-wireless/20241017074654.176678-1-jtornosm@redhat.com/
v2: https://lore.kernel.org/linux-wireless/20241016123452.206671-1-jtornosm@redhat.com/
v1: https://lore.kernel.org/linux-wireless/20241010175102.207324-2-jtornosm@redhat.com/
drivers/net/wireless/ath/ath12k/dp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/wireless/ath/ath12k/dp.c b/drivers/net/wireless/ath/ath12k/dp.c
index 61aa78d8bd8c..789d430e4455 100644
--- a/drivers/net/wireless/ath/ath12k/dp.c
+++ b/drivers/net/wireless/ath/ath12k/dp.c
@@ -1241,6 +1241,7 @@ static void ath12k_dp_cc_cleanup(struct ath12k_base *ab)
}
kfree(dp->spt_info);
+ dp->spt_info = NULL;
}
static void ath12k_dp_reoq_lut_cleanup(struct ath12k_base *ab)
--
2.46.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v4 2/2] wifi: ath12k: fix warning when unbinding
2024-10-17 18:07 [PATCH v4 0/2] wifi: ath12k: fix issues when unbinding Jose Ignacio Tornos Martinez
2024-10-17 18:07 ` [PATCH v4 1/2] wifi: ath12k: fix crash " Jose Ignacio Tornos Martinez
@ 2024-10-17 18:07 ` Jose Ignacio Tornos Martinez
2024-10-22 15:01 ` [PATCH v4 0/2] wifi: ath12k: fix issues " Jeff Johnson
2 siblings, 0 replies; 4+ messages in thread
From: Jose Ignacio Tornos Martinez @ 2024-10-17 18:07 UTC (permalink / raw)
To: kvalo, jjohnson, linux-wireless, ath12k, linux-kernel; +Cc: jtornosm, stable
If there is an error during some initialization related to firmware,
the buffers dp->tx_ring[i].tx_status are released.
However this is released again when the device is unbinded (ath12k_pci),
and we get:
WARNING: CPU: 0 PID: 2098 at mm/slub.c:4689 free_large_kmalloc+0x4d/0x80
Call Trace:
free_large_kmalloc
ath12k_dp_free
ath12k_core_deinit
ath12k_pci_remove
...
The issue is always reproducible from a VM because the MSI addressing
initialization is failing.
In order to fix the issue, just set the buffers to NULL after releasing in
order to avoid the double free.
cc: stable@vger.kernel.org
Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
---
v4:
- Send with cover letter to get reference with 1/2
v3: https://lore.kernel.org/linux-wireless/20241017074854.176765-1-jtornosm@redhat.com/
v2: https://lore.kernel.org/linux-wireless/20241016123722.206899-1-jtornosm@redhat.com/
v1: https://lore.kernel.org/linux-wireless/20241010175102.207324-3-jtornosm@redhat.com/
drivers/net/wireless/ath/ath12k/dp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath12k/dp.c b/drivers/net/wireless/ath/ath12k/dp.c
index 789d430e4455..15061782a2df 100644
--- a/drivers/net/wireless/ath/ath12k/dp.c
+++ b/drivers/net/wireless/ath/ath12k/dp.c
@@ -1277,8 +1277,10 @@ void ath12k_dp_free(struct ath12k_base *ab)
ath12k_dp_rx_reo_cmd_list_cleanup(ab);
- for (i = 0; i < ab->hw_params->max_tx_ring; i++)
+ for (i = 0; i < ab->hw_params->max_tx_ring; i++) {
kfree(dp->tx_ring[i].tx_status);
+ dp->tx_ring[i].tx_status = NULL;
+ }
ath12k_dp_rx_free(ab);
/* Deinit any SOC level resource */
--
2.47.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v4 0/2] wifi: ath12k: fix issues when unbinding
2024-10-17 18:07 [PATCH v4 0/2] wifi: ath12k: fix issues when unbinding Jose Ignacio Tornos Martinez
2024-10-17 18:07 ` [PATCH v4 1/2] wifi: ath12k: fix crash " Jose Ignacio Tornos Martinez
2024-10-17 18:07 ` [PATCH v4 2/2] wifi: ath12k: fix warning " Jose Ignacio Tornos Martinez
@ 2024-10-22 15:01 ` Jeff Johnson
2 siblings, 0 replies; 4+ messages in thread
From: Jeff Johnson @ 2024-10-22 15:01 UTC (permalink / raw)
To: kvalo, jjohnson, linux-wireless, ath12k, linux-kernel,
Jose Ignacio Tornos Martinez
On Thu, 17 Oct 2024 20:07:30 +0200, Jose Ignacio Tornos Martinez wrote:
> wifi: ath12k: fix issues when unbinding
>
> Currently, ath12k driver is not working from VMs but it cannot be unbinded
> either from there. I would like to send these patches to fix the issues that
> I have found in order to get the unbind operation working there, at least to
> fix the errors found during the process when the initial error is detected.
>
> [...]
Applied, thanks!
[1/2] wifi: ath12k: fix crash when unbinding
commit: 1304446f67863385dc4c914b6e0194f6664ee764
[2/2] wifi: ath12k: fix warning when unbinding
commit: ca68ce0d9f4bcd032fd1334441175ae399642a06
Best regards,
--
Jeff Johnson <quic_jjohnson@quicinc.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-10-22 15:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-17 18:07 [PATCH v4 0/2] wifi: ath12k: fix issues when unbinding Jose Ignacio Tornos Martinez
2024-10-17 18:07 ` [PATCH v4 1/2] wifi: ath12k: fix crash " Jose Ignacio Tornos Martinez
2024-10-17 18:07 ` [PATCH v4 2/2] wifi: ath12k: fix warning " Jose Ignacio Tornos Martinez
2024-10-22 15:01 ` [PATCH v4 0/2] wifi: ath12k: fix issues " Jeff Johnson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox