diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2017-08-25 11:24:28 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-25 17:13:04 -0700 |
commit | 7d8697afae5c61a9495fff54a1c5d053dea4505f (patch) | |
tree | e91086000e13794f78f8aa263642a070d77e6a06 /drivers/net/ethernet/huawei | |
parent | cf4828d1666beaef513ce3c8f9e4fe4af1ff4e87 (diff) | |
download | linux-stable-7d8697afae5c61a9495fff54a1c5d053dea4505f.tar.gz linux-stable-7d8697afae5c61a9495fff54a1c5d053dea4505f.tar.bz2 linux-stable-7d8697afae5c61a9495fff54a1c5d053dea4505f.zip |
hinic: skb_pad() frees on error
The skb_pad() function frees the skb on error, so this code has a double
free.
Fixes: 00e57a6d4ad3 ("net-next/hinic: Add Tx operation")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/huawei')
-rw-r--r-- | drivers/net/ethernet/huawei/hinic/hinic_tx.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_tx.c b/drivers/net/ethernet/huawei/hinic/hinic_tx.c index 5bf6a32faa46..abe3e38cd342 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_tx.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_tx.c @@ -192,7 +192,7 @@ netdev_tx_t hinic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) if (skb->len < MIN_SKB_LEN) { if (skb_pad(skb, MIN_SKB_LEN - skb->len)) { netdev_err(netdev, "Failed to pad skb\n"); - goto skb_error; + goto update_error_stats; } skb->len = MIN_SKB_LEN; @@ -237,6 +237,7 @@ flush_skbs: skb_error: dev_kfree_skb_any(skb); +update_error_stats: u64_stats_update_begin(&txq->txq_stats.syncp); txq->txq_stats.tx_dropped++; u64_stats_update_end(&txq->txq_stats.syncp); |