]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Revert "drivers/net/wan/hdlc_fr: Fix a double free in pvc_xmit"
authorXie He <xie.he.0141@gmail.com>
Mon, 3 May 2021 03:51:36 +0000 (20:51 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 3 May 2021 20:37:58 +0000 (13:37 -0700)
This reverts commit 15eff7d75a03
("drivers/net/wan/hdlc_fr: Fix a double free in pvc_xmit").

1. This commit is incorrect. "__skb_pad" will NOT free the skb on
failure when its "free_on_error" parameter is "false".

2. This commit claims to fix my commit. But it didn't CC me??

Fixes: 15eff7d75a03 ("drivers/net/wan/hdlc_fr: Fix a double free in pvc_xmit")
Cc: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Signed-off-by: Xie He <xie.he.0141@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/wan/hdlc_fr.c

index 4d9dc7d159089c2ee12e87c8cffb167ef31af753..0720f5f92caa7b0bfcb80ffb432340356ea7034c 100644 (file)
@@ -415,7 +415,7 @@ static netdev_tx_t pvc_xmit(struct sk_buff *skb, struct net_device *dev)
 
                if (pad > 0) { /* Pad the frame with zeros */
                        if (__skb_pad(skb, pad, false))
-                               goto out;
+                               goto drop;
                        skb_put(skb, pad);
                }
        }
@@ -448,9 +448,8 @@ static netdev_tx_t pvc_xmit(struct sk_buff *skb, struct net_device *dev)
        return NETDEV_TX_OK;
 
 drop:
-       kfree_skb(skb);
-out:
        dev->stats.tx_dropped++;
+       kfree_skb(skb);
        return NETDEV_TX_OK;
 }