netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] idpf: fix mismatched free function for dma_alloc_coherent
@ 2025-09-25 18:02 Alok Tiwari
  2025-09-26 14:03 ` Simon Horman
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Alok Tiwari @ 2025-09-25 18:02 UTC (permalink / raw)
  To: krishneil.k.singh, alan.brady, aleksander.lobakin, andrew+netdev,
	anthony.l.nguyen, przemyslaw.kitszel, davem, edumazet, kuba,
	pabeni, horms, netdev, intel-wired-lan
  Cc: alok.a.tiwari

The mailbox receive path allocates coherent DMA memory with
dma_alloc_coherent(), but frees it with dmam_free_coherent().
This is incorrect since dmam_free_coherent() is only valid for
buffers allocated with dmam_alloc_coherent().

Fix the mismatch by using dma_free_coherent() instead of
dmam_free_coherent

Fixes: e54232da1238 ("idpf: refactor idpf_recv_mb_msg")
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
---
 drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
index 6330d4a0ae07..c1f34381333d 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
@@ -702,9 +702,9 @@ int idpf_recv_mb_msg(struct idpf_adapter *adapter)
 		/* If post failed clear the only buffer we supplied */
 		if (post_err) {
 			if (dma_mem)
-				dmam_free_coherent(&adapter->pdev->dev,
-						   dma_mem->size, dma_mem->va,
-						   dma_mem->pa);
+				dma_free_coherent(&adapter->pdev->dev,
+						  dma_mem->size, dma_mem->va,
+						  dma_mem->pa);
 			break;
 		}
 
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net] idpf: fix mismatched free function for dma_alloc_coherent
  2025-09-25 18:02 [PATCH net] idpf: fix mismatched free function for dma_alloc_coherent Alok Tiwari
@ 2025-09-26 14:03 ` Simon Horman
  2025-09-29  6:28 ` [Intel-wired-lan] " Loktionov, Aleksandr
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2025-09-26 14:03 UTC (permalink / raw)
  To: Alok Tiwari
  Cc: krishneil.k.singh, alan.brady, aleksander.lobakin, andrew+netdev,
	anthony.l.nguyen, przemyslaw.kitszel, davem, edumazet, kuba,
	pabeni, netdev, intel-wired-lan

On Thu, Sep 25, 2025 at 11:02:10AM -0700, Alok Tiwari wrote:
> The mailbox receive path allocates coherent DMA memory with
> dma_alloc_coherent(), but frees it with dmam_free_coherent().
> This is incorrect since dmam_free_coherent() is only valid for
> buffers allocated with dmam_alloc_coherent().
> 
> Fix the mismatch by using dma_free_coherent() instead of
> dmam_free_coherent
> 
> Fixes: e54232da1238 ("idpf: refactor idpf_recv_mb_msg")
> Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [Intel-wired-lan] [PATCH net] idpf: fix mismatched free function for dma_alloc_coherent
  2025-09-25 18:02 [PATCH net] idpf: fix mismatched free function for dma_alloc_coherent Alok Tiwari
  2025-09-26 14:03 ` Simon Horman
@ 2025-09-29  6:28 ` Loktionov, Aleksandr
  2025-09-29 22:53 ` Jacob Keller
  2025-09-30  1:20 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 6+ messages in thread
From: Loktionov, Aleksandr @ 2025-09-29  6:28 UTC (permalink / raw)
  To: Alok Tiwari, Singh, Krishneil K, alan.brady@intel.com,
	Lobakin, Aleksander, andrew+netdev@lunn.ch, Nguyen, Anthony L,
	Kitszel, Przemyslaw, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org



> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> Of Alok Tiwari
> Sent: Thursday, September 25, 2025 8:02 PM
> To: Singh, Krishneil K <krishneil.k.singh@intel.com>;
> alan.brady@intel.com; Lobakin, Aleksander
> <aleksander.lobakin@intel.com>; andrew+netdev@lunn.ch; Nguyen, Anthony
> L <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@intel.com>; davem@davemloft.net;
> edumazet@google.com; kuba@kernel.org; pabeni@redhat.com;
> horms@kernel.org; netdev@vger.kernel.org; intel-wired-
> lan@lists.osuosl.org
> Cc: alok.a.tiwari@oracle.com
> Subject: [Intel-wired-lan] [PATCH net] idpf: fix mismatched free
> function for dma_alloc_coherent
> 
> The mailbox receive path allocates coherent DMA memory with
> dma_alloc_coherent(), but frees it with dmam_free_coherent().
> This is incorrect since dmam_free_coherent() is only valid for buffers
> allocated with dmam_alloc_coherent().
> 
> Fix the mismatch by using dma_free_coherent() instead of
> dmam_free_coherent
> 
> Fixes: e54232da1238 ("idpf: refactor idpf_recv_mb_msg")
> Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
> ---
>  drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> index 6330d4a0ae07..c1f34381333d 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> @@ -702,9 +702,9 @@ int idpf_recv_mb_msg(struct idpf_adapter *adapter)
>  		/* If post failed clear the only buffer we supplied */
>  		if (post_err) {
>  			if (dma_mem)
> -				dmam_free_coherent(&adapter->pdev->dev,
> -						   dma_mem->size, dma_mem-
> >va,
> -						   dma_mem->pa);
> +				dma_free_coherent(&adapter->pdev->dev,
> +						  dma_mem->size, dma_mem->va,
> +						  dma_mem->pa);
>  			break;
>  		}
> 
> --
> 2.50.1

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Intel-wired-lan] [PATCH net] idpf: fix mismatched free function for dma_alloc_coherent
  2025-09-25 18:02 [PATCH net] idpf: fix mismatched free function for dma_alloc_coherent Alok Tiwari
  2025-09-26 14:03 ` Simon Horman
  2025-09-29  6:28 ` [Intel-wired-lan] " Loktionov, Aleksandr
@ 2025-09-29 22:53 ` Jacob Keller
  2025-09-29 23:07   ` Chittim, Madhu
  2025-09-30  1:20 ` patchwork-bot+netdevbpf
  3 siblings, 1 reply; 6+ messages in thread
From: Jacob Keller @ 2025-09-29 22:53 UTC (permalink / raw)
  To: Alok Tiwari, krishneil.k.singh, alan.brady, aleksander.lobakin,
	andrew+netdev, anthony.l.nguyen, przemyslaw.kitszel, davem,
	edumazet, kuba, pabeni, horms, netdev, intel-wired-lan,
	Tantilov, Emil S, Joshua Hay


[-- Attachment #1.1: Type: text/plain, Size: 1833 bytes --]



On 9/25/2025 11:02 AM, Alok Tiwari wrote:
> The mailbox receive path allocates coherent DMA memory with
> dma_alloc_coherent(), but frees it with dmam_free_coherent().
> This is incorrect since dmam_free_coherent() is only valid for
> buffers allocated with dmam_alloc_coherent().
> 
> Fix the mismatch by using dma_free_coherent() instead of
> dmam_free_coherent
> 
> Fixes: e54232da1238 ("idpf: refactor idpf_recv_mb_msg")
> Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
> ---

This is tagged for net, not iwl-net. The fix seems obvious to me, and
unlikely to be covered well by validation tests, due to being an error
cleanup flow.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

I don't have an issue with this being taken directly to net, but would
appreciate an ACK by someone from the idpf driver team first to make
sure we're in agreement. Alternatively, if anyone has objection and
would prefer I pick this up for IWL net dev-queue, please let me know.


>  drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> index 6330d4a0ae07..c1f34381333d 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> @@ -702,9 +702,9 @@ int idpf_recv_mb_msg(struct idpf_adapter *adapter)
>  		/* If post failed clear the only buffer we supplied */
>  		if (post_err) {
>  			if (dma_mem)
> -				dmam_free_coherent(&adapter->pdev->dev,
> -						   dma_mem->size, dma_mem->va,
> -						   dma_mem->pa);
> +				dma_free_coherent(&adapter->pdev->dev,
> +						  dma_mem->size, dma_mem->va,
> +						  dma_mem->pa);
>  			break;
>  		}
>  


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Intel-wired-lan] [PATCH net] idpf: fix mismatched free function for dma_alloc_coherent
  2025-09-29 22:53 ` Jacob Keller
@ 2025-09-29 23:07   ` Chittim, Madhu
  0 siblings, 0 replies; 6+ messages in thread
From: Chittim, Madhu @ 2025-09-29 23:07 UTC (permalink / raw)
  To: Jacob Keller, Alok Tiwari, Singh, Krishneil K,
	alan.brady@intel.com, Lobakin, Aleksander, andrew+netdev@lunn.ch,
	Nguyen, Anthony L, Kitszel, Przemyslaw, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, netdev@vger.kernel.org,
	intel-wired-lan@lists.osuosl.org, Tantilov, Emil S, Hay, Joshua A



On 9/29/2025 3:53 PM, Jacob Keller wrote:
> 
> 
> On 9/25/2025 11:02 AM, Alok Tiwari wrote:
>> The mailbox receive path allocates coherent DMA memory with
>> dma_alloc_coherent(), but frees it with dmam_free_coherent().
>> This is incorrect since dmam_free_coherent() is only valid for
>> buffers allocated with dmam_alloc_coherent().
>>
>> Fix the mismatch by using dma_free_coherent() instead of
>> dmam_free_coherent
>>
>> Fixes: e54232da1238 ("idpf: refactor idpf_recv_mb_msg")
>> Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
>> ---
> 
> This is tagged for net, not iwl-net. The fix seems obvious to me, and
> unlikely to be covered well by validation tests, due to being an error
> cleanup flow.
> 
> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> 
> I don't have an issue with this being taken directly to net, but would
> appreciate an ACK by someone from the idpf driver team first to make
> sure we're in agreement. Alternatively, if anyone has objection and
> would prefer I pick this up for IWL net dev-queue, please let me know.
> 
> 
>>   drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
>> index 6330d4a0ae07..c1f34381333d 100644
>> --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
>> +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
>> @@ -702,9 +702,9 @@ int idpf_recv_mb_msg(struct idpf_adapter *adapter)
>>   		/* If post failed clear the only buffer we supplied */
>>   		if (post_err) {
>>   			if (dma_mem)
>> -				dmam_free_coherent(&adapter->pdev->dev,
>> -						   dma_mem->size, dma_mem->va,
>> -						   dma_mem->pa);
>> +				dma_free_coherent(&adapter->pdev->dev,
>> +						  dma_mem->size, dma_mem->va,
>> +						  dma_mem->pa);
>>   			break;
>>   		}
>>   
> 

Reviewed-by: Madhu Chittim <madhu.chittim@intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net] idpf: fix mismatched free function for dma_alloc_coherent
  2025-09-25 18:02 [PATCH net] idpf: fix mismatched free function for dma_alloc_coherent Alok Tiwari
                   ` (2 preceding siblings ...)
  2025-09-29 22:53 ` Jacob Keller
@ 2025-09-30  1:20 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-09-30  1:20 UTC (permalink / raw)
  To: Alok Tiwari
  Cc: krishneil.k.singh, alan.brady, aleksander.lobakin, andrew+netdev,
	anthony.l.nguyen, przemyslaw.kitszel, davem, edumazet, kuba,
	pabeni, horms, netdev, intel-wired-lan

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 25 Sep 2025 11:02:10 -0700 you wrote:
> The mailbox receive path allocates coherent DMA memory with
> dma_alloc_coherent(), but frees it with dmam_free_coherent().
> This is incorrect since dmam_free_coherent() is only valid for
> buffers allocated with dmam_alloc_coherent().
> 
> Fix the mismatch by using dma_free_coherent() instead of
> dmam_free_coherent
> 
> [...]

Here is the summary with links:
  - [net] idpf: fix mismatched free function for dma_alloc_coherent
    https://git.kernel.org/netdev/net/c/b9bd25f47eb7

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-09-30  1:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-25 18:02 [PATCH net] idpf: fix mismatched free function for dma_alloc_coherent Alok Tiwari
2025-09-26 14:03 ` Simon Horman
2025-09-29  6:28 ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-09-29 22:53 ` Jacob Keller
2025-09-29 23:07   ` Chittim, Madhu
2025-09-30  1:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).