Skip to content

Commit

Permalink
net: tc35815: move free after the dereference
Browse files Browse the repository at this point in the history
We dereference "skb" to get "skb->len" so we should probably do that
step before freeing the skb.

Fixes: eea221c ("tc35815 driver update (take 2)")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Apr 24, 2017
1 parent 1510d72 commit 11faa7b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/toshiba/tc35815.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,8 +1017,8 @@ tc35815_free_queues(struct net_device *dev)
BUG_ON(lp->tx_skbs[i].skb != skb);
#endif
if (skb) {
dev_kfree_skb(skb);
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_dma = 0;
}
Expand Down

0 comments on commit 11faa7b

Please sign in to comment.