Patch "net: gtp: Fix Use-After-Free in gtp_dellink" has been added to the 5.10-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

    net: gtp: Fix Use-After-Free in gtp_dellink

to the 5.10-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:
     net-gtp-fix-use-after-free-in-gtp_dellink.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 81d5accaaf975e74e4ec161c2bbcaffdbee2e9ff
Author: Hyunwoo Kim <v4bel@xxxxxxxxx>
Date:   Mon Apr 22 05:39:30 2024 -0400

    net: gtp: Fix Use-After-Free in gtp_dellink
    
    [ Upstream commit f2a904107ee2b647bb7794a1a82b67740d7c8a64 ]
    
    Since call_rcu, which is called in the hlist_for_each_entry_rcu traversal
    of gtp_dellink, is not part of the RCU read critical section, it
    is possible that the RCU grace period will pass during the traversal and
    the key will be free.
    
    To prevent this, it should be changed to hlist_for_each_entry_safe.
    
    Fixes: 94dc550a5062 ("gtp: fix an use-after-free in ipv4_pdp_find()")
    Signed-off-by: Hyunwoo Kim <v4bel@xxxxxxxxx>
    Reviewed-by: Eric Dumazet <edumazet@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
index 4e19760cddefe..c8246363d3832 100644
--- a/drivers/net/gtp.c
+++ b/drivers/net/gtp.c
@@ -700,11 +700,12 @@ static int gtp_newlink(struct net *src_net, struct net_device *dev,
 static void gtp_dellink(struct net_device *dev, struct list_head *head)
 {
 	struct gtp_dev *gtp = netdev_priv(dev);
+	struct hlist_node *next;
 	struct pdp_ctx *pctx;
 	int i;
 
 	for (i = 0; i < gtp->hash_size; i++)
-		hlist_for_each_entry_rcu(pctx, &gtp->tid_hash[i], hlist_tid)
+		hlist_for_each_entry_safe(pctx, next, &gtp->tid_hash[i], hlist_tid)
 			pdp_context_delete(pctx);
 
 	list_del_rcu(&gtp->list);




[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