Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ixgb: fix bug when freeing resources

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>

authored by

Brandeburg, Jesse and committed by
David S. Miller
23e55a32 1694f25b

+5 -3
+5 -3
drivers/net/ixgb/ixgb_main.c
··· 977 977 978 978 for (i = 0; i < rx_ring->count; i++) { 979 979 buffer_info = &rx_ring->buffer_info[i]; 980 - if (buffer_info->skb) { 981 - 980 + if (buffer_info->dma) { 982 981 pci_unmap_single(pdev, 983 982 buffer_info->dma, 984 983 buffer_info->length, 985 984 PCI_DMA_FROMDEVICE); 985 + buffer_info->dma = 0; 986 + buffer_info->length = 0; 987 + } 986 988 989 + if (buffer_info->skb) { 987 990 dev_kfree_skb(buffer_info->skb); 988 - 989 991 buffer_info->skb = NULL; 990 992 } 991 993 }