提交 7d8697af 编写于 作者: D Dan Carpenter 提交者: David S. Miller

hinic: skb_pad() frees on error

The skb_pad() function frees the skb on error, so this code has a double
free.

Fixes: 00e57a6d ("net-next/hinic: Add Tx operation")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 cf4828d1
...@@ -192,7 +192,7 @@ netdev_tx_t hinic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -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->len < MIN_SKB_LEN) {
if (skb_pad(skb, MIN_SKB_LEN - skb->len)) { if (skb_pad(skb, MIN_SKB_LEN - skb->len)) {
netdev_err(netdev, "Failed to pad skb\n"); netdev_err(netdev, "Failed to pad skb\n");
goto skb_error; goto update_error_stats;
} }
skb->len = MIN_SKB_LEN; skb->len = MIN_SKB_LEN;
...@@ -237,6 +237,7 @@ netdev_tx_t hinic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -237,6 +237,7 @@ netdev_tx_t hinic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
skb_error: skb_error:
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
update_error_stats:
u64_stats_update_begin(&txq->txq_stats.syncp); u64_stats_update_begin(&txq->txq_stats.syncp);
txq->txq_stats.tx_dropped++; txq->txq_stats.tx_dropped++;
u64_stats_update_end(&txq->txq_stats.syncp); u64_stats_update_end(&txq->txq_stats.syncp);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册