mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
945fae44d3
commit
6f97532ef0
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue