tg3: Fix DMA mapping leak in tigon3_dma_hwbug_workaround().

Noticed by Michael Chan.

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2008-09-11 15:45:19 -07:00
parent 90079ce89a
commit 638266f7e8
1 changed files with 3 additions and 0 deletions

View File

@ -4631,6 +4631,9 @@ static int tigon3_dma_hwbug_workaround(struct tg3 *tp, struct sk_buff *skb,
* Drop the packet if it does.
*/
if (ret || tg3_4g_overflow_test(new_addr, new_skb->len)) {
if (!ret)
skb_dma_unmap(&tp->pdev->dev, new_skb,
DMA_TO_DEVICE);
ret = -1;
dev_kfree_skb(new_skb);
new_skb = NULL;