* [PATCH] hinic: skb_pad() frees on error
@ 2017-08-25 8:24 Dan Carpenter
2017-08-26 0:14 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-08-25 8:24 UTC (permalink / raw)
To: Aviad Krawczyk; +Cc: netdev, kernel-janitors
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>
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 @@ netdev_tx_t hinic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
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);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hinic: skb_pad() frees on error
2017-08-25 8:24 [PATCH] hinic: skb_pad() frees on error Dan Carpenter
@ 2017-08-26 0:14 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-08-26 0:14 UTC (permalink / raw)
To: dan.carpenter; +Cc: aviad.krawczyk, netdev, kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Fri, 25 Aug 2017 11:24:28 +0300
> 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>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-26 0:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-25 8:24 [PATCH] hinic: skb_pad() frees on error Dan Carpenter
2017-08-26 0:14 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).