Patch "drivers/net/wan/hdlc_fr: Fix a double free in pvc_xmit" has been added to the 5.11-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drivers/net/wan/hdlc_fr: Fix a double free in pvc_xmit

to the 5.11-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drivers-net-wan-hdlc_fr-fix-a-double-free-in-pvc_xmi.patch
and it can be found in the queue-5.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 9c07417b0cebd5d049805d6bb86b5624ffff82b0
Author: Lv Yunlong <lyl2019@xxxxxxxxxxxxxxxx>
Date:   Sun Mar 28 00:50:08 2021 -0700

    drivers/net/wan/hdlc_fr: Fix a double free in pvc_xmit
    
    [ Upstream commit 1b479fb801602b22512f53c19b1f93a4fc5d5d9d ]
    
    In pvc_xmit, if __skb_pad(skb, pad, false) failed, it will free
    the skb in the first time and goto drop. But the same skb is freed
    by kfree_skb(skb) in the second time in drop.
    
    Maintaining the original function unchanged, my patch adds a new
    label out to avoid the double free if __skb_pad() failed.
    
    Fixes: f5083d0cee08a ("drivers/net/wan/hdlc_fr: Improvements to the code of pvc_xmit")
    Signed-off-by: Lv Yunlong <lyl2019@xxxxxxxxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
index 0720f5f92caa..4d9dc7d15908 100644
--- a/drivers/net/wan/hdlc_fr.c
+++ b/drivers/net/wan/hdlc_fr.c
@@ -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 drop;
+				goto out;
 			skb_put(skb, pad);
 		}
 	}
@@ -448,8 +448,9 @@ static netdev_tx_t pvc_xmit(struct sk_buff *skb, struct net_device *dev)
 	return NETDEV_TX_OK;
 
 drop:
-	dev->stats.tx_dropped++;
 	kfree_skb(skb);
+out:
+	dev->stats.tx_dropped++;
 	return NETDEV_TX_OK;
 }
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux