summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephen hemminger <shemming@brocade.com>2015-11-18 01:24:27 +0300
committerDavid S. Miller <davem@davemloft.net>2015-11-18 22:58:03 +0300
commit6f97532ef05e49f1998a09f8359b83d00a7b3229 (patch)
tree2e579cee5721956c5f5fad269477e826376a932d
parent945fae44d316a572916f673b2a58cd2d5389e7b6 (diff)
downloadlinux-6f97532ef05e49f1998a09f8359b83d00a7b3229.tar.xz
fm10k: fix memory leak
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>
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_netdev.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
index 639263d5e833..7781e80896a6 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
@@ -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);