Patch "bpf: Fix mismatched RCU unlock flavour in bpf_out_neigh_v6" has been added to the 6.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

    bpf: Fix mismatched RCU unlock flavour in bpf_out_neigh_v6

to the 6.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:
     bpf-fix-mismatched-rcu-unlock-flavour-in-bpf_out_nei.patch
and it can be found in the queue-6.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 ab3bbb39c05e00dd2ba548e5bb14acbb316288e6
Author: Jiawei Ye <jiawei.ye@xxxxxxxxxxx>
Date:   Fri Nov 8 08:18:52 2024 +0000

    bpf: Fix mismatched RCU unlock flavour in bpf_out_neigh_v6
    
    [ Upstream commit fb86c42a2a5d44e849ddfbc98b8d2f4f40d36ee3 ]
    
    In the bpf_out_neigh_v6 function, rcu_read_lock() is used to begin an RCU
    read-side critical section. However, when unlocking, one branch
    incorrectly uses a different RCU unlock flavour rcu_read_unlock_bh()
    instead of rcu_read_unlock(). This mismatch in RCU locking flavours can
    lead to unexpected behavior and potential concurrency issues.
    
    This possible bug was identified using a static analysis tool developed
    by myself, specifically designed to detect RCU-related issues.
    
    This patch corrects the mismatched unlock flavour by replacing the
    incorrect rcu_read_unlock_bh() with the appropriate rcu_read_unlock(),
    ensuring that the RCU critical section is properly exited. This change
    prevents potential synchronization issues and aligns with proper RCU
    usage patterns.
    
    Fixes: 09eed1192cec ("neighbour: switch to standard rcu, instead of rcu_bh")
    Signed-off-by: Jiawei Ye <jiawei.ye@xxxxxxxxxxx>
    Acked-by: Yonghong Song <yonghong.song@xxxxxxxxx>
    Link: https://lore.kernel.org/r/tencent_CFD3D1C3D68B45EA9F52D8EC76D2C4134306@xxxxxx
    Signed-off-by: Martin KaFai Lau <martin.lau@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/core/filter.c b/net/core/filter.c
index b2b551401bc29..fe5ac8da5022f 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -2248,7 +2248,7 @@ static int bpf_out_neigh_v6(struct net *net, struct sk_buff *skb,
 		rcu_read_unlock();
 		return ret;
 	}
-	rcu_read_unlock_bh();
+	rcu_read_unlock();
 	if (dst)
 		IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES);
 out_drop:




[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