From: Ivan Vecera <ivecera@redhat.com> Date: Fri, 4 Sep 2009 14:52:58 +0200 Subject: [net] r8169: balance pci_map/unmap pair, use hw padding Message-id: 1252068778-6015-1-git-send-email-ivecera@redhat.com O-Subject: [RHEL5.5 PATCH] r8169: balance pci_map/pci_unmap pair and use hardware auto-padding Bugzilla: 515857 RH-Acked-by: Jiri Pirko <jpirko@redhat.com> RH-Acked-by: Neil Horman <nhorman@redhat.com> RH-Acked-by: Michal Schmidt <mschmidt@redhat.com> BZs: #515857 - flood ping cause out-of-iommu error and panic when mtu larger than 1500 Description: This patch fixes the pci_unmap_single leak that causes a system panic when MTU larger than 1500 is used. Also fixes another pci_unmap leak with padded skb, in this case we can use hardware auto-padding. Upstream commits: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=a866bbf6aacf95f849810079442a20be118ce905 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=97d477a914b146e7e6722ded21afa79886ae8ccd Test status: Tested successfully by myself and also by bug reporter. Signed-off-by: Ivan Vecera <ivecera@redhat.com> diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 48ca235..c8ebaee 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c @@ -3239,13 +3239,6 @@ static int rtl8169_start_xmit(struct sk_buff *skb, struct net_device *dev) opts1 |= FirstFrag; } else { len = skb->len; - - if (unlikely(len < ETH_ZLEN)) { - if (skb_padto(skb, ETH_ZLEN)) - goto err_update_stats; - len = ETH_ZLEN; - } - opts1 |= FirstFrag | LastFrag; tp->tx_skb[entry].skb = skb; } @@ -3283,7 +3276,6 @@ out: err_stop: netif_stop_queue(dev); ret = NETDEV_TX_BUSY; -err_update_stats: tp->stats.tx_dropped++; goto out; } @@ -3495,7 +3487,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev, pkt_size, PCI_DMA_FROMDEVICE); rtl8169_mark_to_asic(desc, tp->rx_buf_sz); } else { - pci_unmap_single(pdev, addr, pkt_size, + pci_unmap_single(pdev, addr, tp->rx_buf_sz, PCI_DMA_FROMDEVICE); tp->Rx_skbuff[entry] = NULL; }