Commit 4717cd19 authored by Dan Carpenter's avatar Dan Carpenter Committed by Ben Hutchings

net: tc35815: move free after the dereference

commit 11faa7b0 upstream.

We dereference "skb" to get "skb->len" so we should probably do that
step before freeing the skb.

Fixes: eea221ce ("tc35815 driver update (take 2)")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 8d291d37
...@@ -1053,8 +1053,8 @@ tc35815_free_queues(struct net_device *dev) ...@@ -1053,8 +1053,8 @@ tc35815_free_queues(struct net_device *dev)
BUG_ON(lp->tx_skbs[i].skb != skb); BUG_ON(lp->tx_skbs[i].skb != skb);
#endif #endif
if (skb) { if (skb) {
dev_kfree_skb(skb);
pci_unmap_single(lp->pci_dev, lp->tx_skbs[i].skb_dma, skb->len, PCI_DMA_TODEVICE); pci_unmap_single(lp->pci_dev, lp->tx_skbs[i].skb_dma, skb->len, PCI_DMA_TODEVICE);
dev_kfree_skb(skb);
lp->tx_skbs[i].skb = NULL; lp->tx_skbs[i].skb = NULL;
lp->tx_skbs[i].skb_dma = 0; lp->tx_skbs[i].skb_dma = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment