Patchwork BUG in netxen_release_tx_buffers when TSO enabled on kernels >= 3.3 and <= 3.6

login
register
mail settings
Submitter Eric Dumazet
Date Jan. 22, 2013, 1:56 p.m.
Message ID <1358862966.3464.3797.camel@edumazet-glaptop>
Download mbox | patch
Permalink /patch/214551/
State RFC
Delegated to: David Miller
Headers show

Comments

Eric Dumazet - Jan. 22, 2013, 1:56 p.m.
On Tue, 2013-01-22 at 05:32 -0800, Eric Dumazet wrote:

> 
> Something doesn't properly test MAX_SKB_FRAGS, we should track it and
> fix.

I guess netxen driver has a bug.

Please try the following patch :



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christoph Paasch - Jan. 22, 2013, 3:03 p.m.
On Tuesday 22 January 2013 05:56:06 Eric Dumazet wrote:
> I guess netxen driver has a bug.
> 
> Please try the following patch :
> 
> diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
> b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c index
> bc165f4..695667d 100644
> --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
> +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
> @@ -144,7 +144,7 @@ void netxen_release_tx_buffers(struct netxen_adapter
> *adapter) buffrag->length, PCI_DMA_TODEVICE); buffrag->dma = 0ULL;
>                 }
> -               for (j = 0; j < cmd_buf->frag_count; j++) {
> +               for (j = 1; j < cmd_buf->frag_count; j++) {
>                         buffrag++;
>                         if (buffrag->dma) {
>                                 pci_unmap_page(adapter->pdev, buffrag->dma,

Perfect, I tested it, and this fixes the bug.

I should have found it on my own, I have been starring for too long at this 
function... :)

Feel free to add
Tested-by: Christoph Paasch <christoph.paasch@uclouvain.be>


Thanks, Eric!


Christoph
Ben Hutchings - Jan. 22, 2013, 7:36 p.m.
On Tue, 2013-01-22 at 05:56 -0800, Eric Dumazet wrote:
> On Tue, 2013-01-22 at 05:32 -0800, Eric Dumazet wrote:
> 
> > 
> > Something doesn't properly test MAX_SKB_FRAGS, we should track it and
> > fix.
> 
> I guess netxen driver has a bug.
> 
> Please try the following patch :
> 
> diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
> index bc165f4..695667d 100644
> --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
> +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
> @@ -144,7 +144,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter)
>  					 buffrag->length, PCI_DMA_TODEVICE);
>  			buffrag->dma = 0ULL;
>  		}
> -		for (j = 0; j < cmd_buf->frag_count; j++) {
> +		for (j = 1; j < cmd_buf->frag_count; j++) {
>  			buffrag++;
>  			if (buffrag->dma) {
>  				pci_unmap_page(adapter->pdev, buffrag->dma,
> 

There's another bug right here, which is that 0 is a valid DMA address
in some systems.  The driver should be calling pci_dma_mapping_error()
to find out whether an address is valid or not.  But it also wants to be
able to assign an invalid address to netxen_skb_frag::dma, and
unfortunately there is no way to do that in the current DMA API.

Ben.
Eric Dumazet - Jan. 22, 2013, 7:59 p.m.
On Tue, 2013-01-22 at 19:36 +0000, Ben Hutchings wrote:

> There's another bug right here, which is that 0 is a valid DMA address
> in some systems.  The driver should be calling pci_dma_mapping_error()
> to find out whether an address is valid or not.  But it also wants to be
> able to assign an invalid address to netxen_skb_frag::dma, and
> unfortunately there is no way to do that in the current DMA API.
> 

I guess we should only test ->frag_count then, and set it to 0 in TX
completion path.




--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rajesh Borundia - Jan. 23, 2013, 7:47 p.m.
>-----Original Message-----

>From: Eric Dumazet [mailto:eric.dumazet@gmail.com]

>Sent: Wednesday, January 23, 2013 1:30 AM

>To: Ben Hutchings

>Cc: christoph.paasch@uclouvain.be; Ian Campbell; Sony Chacko; Rajesh

>Borundia; David Miller; netdev

>Subject: Re: BUG in netxen_release_tx_buffers when TSO enabled on

>kernels >= 3.3 and <= 3.6

>

>On Tue, 2013-01-22 at 19:36 +0000, Ben Hutchings wrote:

>

>> There's another bug right here, which is that 0 is a valid DMA address

>> in some systems.  The driver should be calling pci_dma_mapping_error()

>> to find out whether an address is valid or not.  But it also wants to

>be

>> able to assign an invalid address to netxen_skb_frag::dma, and

>> unfortunately there is no way to do that in the current DMA API.

>>

>

>I guess we should only test ->frag_count then, and set it to 0 in TX

>completion path.

>

We will send a patch with the suggested fix.

Patch

diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
index bc165f4..695667d 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
@@ -144,7 +144,7 @@  void netxen_release_tx_buffers(struct netxen_adapter *adapter)
 					 buffrag->length, PCI_DMA_TODEVICE);
 			buffrag->dma = 0ULL;
 		}
-		for (j = 0; j < cmd_buf->frag_count; j++) {
+		for (j = 1; j < cmd_buf->frag_count; j++) {
 			buffrag++;
 			if (buffrag->dma) {
 				pci_unmap_page(adapter->pdev, buffrag->dma,