Skip to content

Commit

Permalink
fm10k: fix memory leak
Browse files Browse the repository at this point in the history
This was detected by Coverity.
The function skb_cow_head leaves skb alone on failure, so caller needs
to free.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
stephen hemminger authored and David S. Miller committed Nov 18, 2015
1 parent 945fae4 commit 6f97532
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,10 @@ static netdev_tx_t fm10k_xmit_frame(struct sk_buff *skb, struct net_device *dev)

/* verify the skb head is not shared */
err = skb_cow_head(skb, 0);
if (err)
if (err) {
dev_kfree_skb(skb);
return NETDEV_TX_OK;
}

/* locate vlan header */
vhdr = (struct vlan_hdr *)(skb->data + ETH_HLEN);
Expand Down

0 comments on commit 6f97532

Please sign in to comment.