| Submitter | Jeff Kirsher |
|---|---|
| Date | Dec. 12, 2008, 9:51 a.m. |
| Message ID | <20081212095104.4380.49487.stgit@lost.foo-projects.org> |
| Download | mbox | patch |
| Permalink | /patch/13692/ |
| State | Accepted |
| Delegated to: | David Miller |
| Headers | show |
Comments
Nice. I discoverd a couple more bugs in this driver while testing my IOMMU code. One bug can only be found with an hardware IOMMU. This seems to be a use-after-free bug, at least I see IO_PAGE_FAULTS from the IOMMU originating from this card. Maybe you can change the VT-d code so that you can debug this issue. I didn't found the time yet to do a v2 of my DMA-API debugging patches. But I hope can will the time for this next week. Then you have something in hand to debug the driver even further :) Joerg On Fri, Dec 12, 2008 at 01:51:05AM -0800, Jeff Kirsher wrote: > From: Jesse Brandeburg <jesse.brandeburg@intel.com> > > This issue was initially reported by Joerg Roedel <joerg.roedel@amd.com> > It appears that ixgbe has had a long standing bug where it was > unmapping a different size than it had mapped.
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Date: Fri, 12 Dec 2008 01:51:05 -0800 > This issue was initially reported by Joerg Roedel <joerg.roedel@amd.com> > It appears that ixgbe has had a long standing bug where it was unmapping a different size than it had mapped. ... > Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Applied. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Patch
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index d6f666a..92b35cf 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c @@ -479,7 +479,6 @@ static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter, union ixgbe_adv_rx_desc *rx_desc; struct ixgbe_rx_buffer *bi; unsigned int i; - unsigned int bufsz = rx_ring->rx_buf_len + NET_IP_ALIGN; i = rx_ring->next_to_use; bi = &rx_ring->rx_buffer_info[i]; @@ -508,8 +507,10 @@ static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter, } if (!bi->skb) { - struct sk_buff *skb = netdev_alloc_skb(adapter->netdev, - bufsz); + struct sk_buff *skb; + skb = netdev_alloc_skb(adapter->netdev, + (rx_ring->rx_buf_len + + NET_IP_ALIGN)); if (!skb) { adapter->alloc_rx_buff_failed++; @@ -524,7 +525,8 @@ static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter, skb_reserve(skb, NET_IP_ALIGN); bi->skb = skb; - bi->dma = pci_map_single(pdev, skb->data, bufsz, + bi->dma = pci_map_single(pdev, skb->data, + rx_ring->rx_buf_len, PCI_DMA_FROMDEVICE); } /* Refresh the desc even if buffer_addrs didn't change because @@ -615,7 +617,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_adapter *adapter, if (len && !skb_shinfo(skb)->nr_frags) { pci_unmap_single(pdev, rx_buffer_info->dma, - rx_ring->rx_buf_len + NET_IP_ALIGN, + rx_ring->rx_buf_len, PCI_DMA_FROMDEVICE); skb_put(skb, len); }