]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ixgb: fix bug when freeing resources
authorBrandeburg, Jesse <jesse.brandeburg@intel.com>
Tue, 30 Sep 2008 13:08:48 +0000 (13:08 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 8 Oct 2008 23:53:40 +0000 (16:53 -0700)
It was pointed out by Breno Leitao <leitao@linux.vnet.ibm.com> that
ixgb would crash on PPC when an IOMMU was in use, if change_mtu was
called.

It appears to be a pretty simple issue in the driver that wasn't discovered
because most systems don't run with an IOMMU.  The driver needs to only unmap
buffers that are mapped (duh).

CC: Breno Leitao <leitao@linux.vnet.ibm.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ixgb/ixgb_main.c

index aa75385cd6c7ca67bfbc7c851db2101f986dd965..be3c7dc96f633d2842d6394abd72a469b27e6dab 100644 (file)
@@ -977,15 +977,17 @@ ixgb_clean_rx_ring(struct ixgb_adapter *adapter)
 
        for (i = 0; i < rx_ring->count; i++) {
                buffer_info = &rx_ring->buffer_info[i];
-               if (buffer_info->skb) {
-
+               if (buffer_info->dma) {
                        pci_unmap_single(pdev,
                                         buffer_info->dma,
                                         buffer_info->length,
                                         PCI_DMA_FROMDEVICE);
+                       buffer_info->dma = 0;
+                       buffer_info->length = 0;
+               }
 
+               if (buffer_info->skb) {
                        dev_kfree_skb(buffer_info->skb);
-
                        buffer_info->skb = NULL;
                }
        }