netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] skge: fix invalid value passed to pci_unmap_sigle
@ 2013-09-20 17:53 Mikulas Patocka
  2013-09-21 22:12 ` Sergei Shtylyov
  2013-09-24 14:18 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Mikulas Patocka @ 2013-09-20 17:53 UTC (permalink / raw)
  To: David Miller, netdev; +Cc: Francois Romieu, Igor Gnatenko, stephen

In my patch c194992cbe71c20bb3623a566af8d11b0bfaa721 I didn't fix the skge
bug correctly. The value of the new mapping (not old) was passed to
pci_unmap_single.

If we enable CONFIG_DMA_API_DEBUG, it results in this warning:
WARNING: CPU: 0 PID: 0 at lib/dma-debug.c:986 check_sync+0x4c4/0x580()
skge 0000:02:07.0: DMA-API: device driver tries to sync DMA memory it has
not allocated [device address=0x000000023a0096c0] [size=1536 bytes]

This patch makes the skge driver pass the correct value to
pci_unmap_single and fixes the warning. It copies the old descriptor to
on-stack variable "ee" and unmaps it if mapping of the new descriptor
succeeded.

This patch should be backported to 3.11-stable.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reported-by: Francois Romieu <romieu@fr.zoreil.com>
Tested-by: Mikulas Patocka <mpatocka@redhat.com>

---
 drivers/net/ethernet/marvell/skge.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Index: linux-3.11.1-fast/drivers/net/ethernet/marvell/skge.c
===================================================================
--- linux-3.11.1-fast.orig/drivers/net/ethernet/marvell/skge.c	2013-09-20 16:13:24.000000000 +0200
+++ linux-3.11.1-fast/drivers/net/ethernet/marvell/skge.c	2013-09-20 16:18:13.000000000 +0200
@@ -3086,13 +3086,16 @@ static struct sk_buff *skge_rx_get(struc
 					       PCI_DMA_FROMDEVICE);
 		skge_rx_reuse(e, skge->rx_buf_size);
 	} else {
+		struct skge_element ee;
 		struct sk_buff *nskb;
 
 		nskb = netdev_alloc_skb_ip_align(dev, skge->rx_buf_size);
 		if (!nskb)
 			goto resubmit;
 
-		skb = e->skb;
+		ee = *e;
+
+		skb = ee.skb;
 		prefetch(skb->data);
 
 		if (skge_rx_setup(skge, e, nskb, skge->rx_buf_size) < 0) {
@@ -3101,8 +3104,8 @@ static struct sk_buff *skge_rx_get(struc
 		}
 
 		pci_unmap_single(skge->hw->pdev,
-				 dma_unmap_addr(e, mapaddr),
-				 dma_unmap_len(e, maplen),
+				 dma_unmap_addr(&ee, mapaddr),
+				 dma_unmap_len(&ee, maplen),
 				 PCI_DMA_FROMDEVICE);
 	}
 

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

* Re: [PATCH] skge: fix invalid value passed to pci_unmap_sigle
  2013-09-20 17:53 [PATCH] skge: fix invalid value passed to pci_unmap_sigle Mikulas Patocka
@ 2013-09-21 22:12 ` Sergei Shtylyov
  2013-09-24 14:18 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2013-09-21 22:12 UTC (permalink / raw)
  To: Mikulas Patocka
  Cc: David Miller, netdev, Francois Romieu, Igor Gnatenko, stephen

Hello.

On 09/20/2013 09:53 PM, Mikulas Patocka wrote:

> In my patch c194992cbe71c20bb3623a566af8d11b0bfaa721 I didn't fix the skge

    Please also specify that commit's summary in parens.

> bug correctly. The value of the new mapping (not old) was passed to
> pci_unmap_single.

> If we enable CONFIG_DMA_API_DEBUG, it results in this warning:
> WARNING: CPU: 0 PID: 0 at lib/dma-debug.c:986 check_sync+0x4c4/0x580()
> skge 0000:02:07.0: DMA-API: device driver tries to sync DMA memory it has
> not allocated [device address=0x000000023a0096c0] [size=1536 bytes]

> This patch makes the skge driver pass the correct value to
> pci_unmap_single and fixes the warning. It copies the old descriptor to
> on-stack variable "ee" and unmaps it if mapping of the new descriptor
> succeeded.

> This patch should be backported to 3.11-stable.

> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> Reported-by: Francois Romieu <romieu@fr.zoreil.com>
> Tested-by: Mikulas Patocka <mpatocka@redhat.com>

WBR, Sergei

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

* Re: [PATCH] skge: fix invalid value passed to pci_unmap_sigle
  2013-09-20 17:53 [PATCH] skge: fix invalid value passed to pci_unmap_sigle Mikulas Patocka
  2013-09-21 22:12 ` Sergei Shtylyov
@ 2013-09-24 14:18 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2013-09-24 14:18 UTC (permalink / raw)
  To: mpatocka; +Cc: netdev, romieu, i.gnatenko.brain, stephen

From: Mikulas Patocka <mpatocka@redhat.com>
Date: Fri, 20 Sep 2013 13:53:22 -0400 (EDT)

> In my patch c194992cbe71c20bb3623a566af8d11b0bfaa721 I didn't fix the skge

Always refer to commits, not just by SHA ID, but also with the commit
header line text in parenthesis and double quotes, for this you'd say:

c194992cbe71c20bb3623a566af8d11b0bfaa721 ("skge: fix broken driver")

Using just the SHA ID is completely ambiguous, because the SHA ID will
be entirely different if this commit is added to a different tree, such
as -stable.

> bug correctly. The value of the new mapping (not old) was passed to
> pci_unmap_single.
> 
> If we enable CONFIG_DMA_API_DEBUG, it results in this warning:
> WARNING: CPU: 0 PID: 0 at lib/dma-debug.c:986 check_sync+0x4c4/0x580()
> skge 0000:02:07.0: DMA-API: device driver tries to sync DMA memory it has
> not allocated [device address=0x000000023a0096c0] [size=1536 bytes]
> 
> This patch makes the skge driver pass the correct value to
> pci_unmap_single and fixes the warning. It copies the old descriptor to
> on-stack variable "ee" and unmaps it if mapping of the new descriptor
> succeeded.
> 
> This patch should be backported to 3.11-stable.
> 
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> Reported-by: Francois Romieu <romieu@fr.zoreil.com>
> Tested-by: Mikulas Patocka <mpatocka@redhat.com>

Applied and queued up for -stable, thanks.

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

end of thread, other threads:[~2013-09-24 14:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-20 17:53 [PATCH] skge: fix invalid value passed to pci_unmap_sigle Mikulas Patocka
2013-09-21 22:12 ` Sergei Shtylyov
2013-09-24 14:18 ` David Miller

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).