ath10k: Correct error check of dma_map_single()
PATCH 1/1 ath10k: Correct error check of dma_map_single()
The return value of dma_map_single() should be checked for errors using dma_mapping_error(), rather than testing for NULL. Correct this.
--- drivers/net/wireless/ath/ath10k/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/mac.c +1 -1
@@ -3904,7 +3904,7 @@ void ath10k_mgmt_over_wmi_tx_work(struct work_struct *work) ar->running_fw->fw_file.fw_features)) { paddr =dma_map_single (ar->dev, skb->data, skb->len,DMA_TO_DEVICE ); -if (!paddr) +if (dma_mapping_error (ar->dev, paddr))continue ; ret =ath10k_wmi_mgmt_tx_send (ar, skb, paddr);if (ret) {
Signature · 7 lines
2.23.0 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 7 lines · Bjorn Andersson
The return value of
dma_map_single()should be checked for errors usingdma_mapping_error(), rather than testing for NULL. Correct this.Fixes 1807da49733e ("ath10k: wmi: add management tx by reference support over wmi")Reported-by Niklas Cassel <[email protected]>Signed-off-by Bjorn Andersson <[email protected]>
Did this fix any real bug? Or is this just something found during code review?
Signature · 9 lines
https://patchwork.kernel.org/patch/11183923/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 5 lines · Kalle Valo
Quoted 3 lines · Bjorn Andersson
The return value of
dma_map_single()should be checked for errors usingdma_mapping_error(), rather than testing for NULL. Correct this.
Quoted 7 lines
Quoted 4 lines
Fixes 1807da49733e ("ath10k: wmi: add management tx by reference support over wmi")Reported-by Niklas Cassel <[email protected]>Signed-off-by Bjorn Andersson <[email protected]>Did this fix any real bug? Or is this just something found during code review?
CONFIG_DMA_API_DEBUG screamed at us for calling dma_unmap_single() without ever having called dma_mapping_error() on the return value.
But Govind just pointed out to me that I hastily missed the fact that this code path leaks the dequeued skb. So I'll respin the patch to fix both issues at once.
Regards,
Bjorn
Quoted 10 lines
Signature · 9 lines
https://patchwork.kernel.org/patch/11183923/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 13 lines · Bjorn Andersson
Quoted 11 lines · Kalle Valo
Quoted 8 lines · Bjorn Andersson
The return value of
dma_map_single()should be checked for errors usingdma_mapping_error(), rather than testing for NULL. Correct this.Fixes 1807da49733e ("ath10k: wmi: add management tx by referencesupport over wmi")
Reported-by Niklas Cassel <[email protected]>Signed-off-by Bjorn Andersson <[email protected]>
Quoted 5 lines
Quoted 2 lines
Did this fix any real bug? Or is this just something found during code review?
CONFIG_DMA_API_DEBUGscreamed at us for callingdma_unmap_single()without ever having calleddma_mapping_error()on the return value.
Ok, I'll add something about to the commit log in v2 so that the background is also documented.
Signature · 6 lines
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 7 lines · Bjorn Andersson
The return value of
dma_map_single()should be checked for errors usingdma_mapping_error(), rather than testing for NULL. Correct this.Fixes 1807da49733e ("ath10k: wmi: add management tx by reference support over wmi")Reported-by Niklas Cassel <[email protected]>Signed-off-by Bjorn Andersson <[email protected]>
Did this fix any real bug? Or is this just something found during code review?
Signature · 3 lines
https://patchwork.kernel.org/patch/11183923/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
PATCH v2 1/1 ath10k: Correct error handling of dma_map_single()
In reply to Bjorn AnderssonThe return value of dma_map_single() should be checked for errors using dma_mapping_error() and the skb has been dequeued so it needs to be freed.
---
Changes since v1:
- Free the dequeued skb
drivers/net/wireless/ath/ath10k/mac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/mac.c +3 -1
@@ -3904,8 +3904,10 @@ void ath10k_mgmt_over_wmi_tx_work(struct work_struct *work) ar->running_fw->fw_file.fw_features)) { paddr =dma_map_single (ar->dev, skb->data, skb->len,DMA_TO_DEVICE ); -if (!paddr) +if (dma_mapping_error (ar->dev, paddr)) { +ieee80211_free_txskb (ar->hw, skb);continue ; + } ret =ath10k_wmi_mgmt_tx_send (ar, skb, paddr);if (ret) { ath10k_warn(ar, "failed to transmit management frame by ref via WMI: %d\n",
Signature · 7 lines
2.23.0 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Re: [PATCH v2] ath10k: Correct error handling of dma_map_single()
Quoted 11 lines · Bjorn Andersson
The return value of
dma_map_single()should be checked for errors usingdma_mapping_error()and the skb has been dequeued so it needs to be freed.This was found when enabling
CONFIG_DMA_API_DEBUGand it warned about the missingdma_mapping_error()call.Fixes 1807da49733e ("ath10k: wmi: add management tx by reference support over wmi")Reported-by Niklas Cassel <[email protected]>Signed-off-by Bjorn Andersson <[email protected]>Signed-off-by Kalle Valo <[email protected]>
Patch applied to ath-next branch of ath.git, thanks.
d43810b2c180 ath10k: Correct error handling of dma_map_single()
Signature · 3 lines
https://patchwork.kernel.org/patch/11186173/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Re: [PATCH v2] ath10k: Correct error handling of dma_map_single()
In reply to Bjorn AnderssonQuoted 11 lines · Bjorn Andersson
The return value of
dma_map_single()should be checked for errors usingdma_mapping_error()and the skb has been dequeued so it needs to be freed.This was found when enabling
CONFIG_DMA_API_DEBUGand it warned about the missingdma_mapping_error()call.Fixes 1807da49733e ("ath10k: wmi: add management tx by reference support over wmi")Reported-by Niklas Cassel <[email protected]>Signed-off-by Bjorn Andersson <[email protected]>Signed-off-by Kalle Valo <[email protected]>
Patch applied to ath-next branch of ath.git, thanks.
d43810b2c180 ath10k: Correct error handling of dma_map_single()
Signature · 9 lines
https://patchwork.kernel.org/patch/11186173/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k