netxen: fix infinite loop on dma mapping failure
authorDhananjay Phadke <dhananjay@netxen.com>
Thu, 3 Sep 2009 13:10:55 +0000 (13:10 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 4 Sep 2009 03:02:04 +0000 (20:02 -0700)
Fix a perpetual while() loop in unwinding partial
mapped tx skb on dma mapping failure.

Reported-by: "Juha Leppanen" <juha_motorsportcom@luukku.com>
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/netxen/netxen_nic_main.c

index 53d57dc4d644b50948717d81ce6045d1e24d08e7..41b29671fc9a196437292b55007fcdf439868c01 100644 (file)
@@ -1577,8 +1577,8 @@ netxen_map_tx_skb(struct pci_dev *pdev,
        return 0;
 
 unwind:
-       while (i > 0) {
-               nf = &pbuf->frag_array[i];
+       while (--i >= 0) {
+               nf = &pbuf->frag_array[i+1];
                pci_unmap_page(pdev, nf->dma, nf->length, PCI_DMA_TODEVICE);
        }