Patch "flow_dissector: Fix port range key handling in BPF conversion" has been added to the 5.15-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

    flow_dissector: Fix port range key handling in BPF conversion

to the 5.15-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:
     flow_dissector-fix-port-range-key-handling-in-bpf-co.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 883f5686772003a1b0b66f5cd4b211c39b64b9b1
Author: Cong Wang <xiyou.wangcong@xxxxxxxxx>
Date:   Mon Feb 17 20:32:09 2025 -0800

    flow_dissector: Fix port range key handling in BPF conversion
    
    [ Upstream commit 69ab34f705fbfabcace64b5d53bb7a4450fac875 ]
    
    Fix how port range keys are handled in __skb_flow_bpf_to_target() by:
    - Separating PORTS and PORTS_RANGE key handling
    - Using correct key_ports_range structure for range keys
    - Properly initializing both key types independently
    
    This ensures port range information is correctly stored in its dedicated
    structure rather than incorrectly using the regular ports key structure.
    
    Fixes: 59fb9b62fb6c ("flow_dissector: Fix to use new variables for port ranges in bpf hook")
    Reported-by: Qiang Zhang <dtzq01@xxxxxxxxx>
    Closes: https://lore.kernel.org/netdev/CAPx+-5uvFxkhkz4=j_Xuwkezjn9U6kzKTD5jz4tZ9msSJ0fOJA@xxxxxxxxxxxxxx/
    Cc: Yoshiki Komachi <komachi.yoshiki@xxxxxxxxx>
    Cc: Jamal Hadi Salim <jhs@xxxxxxxxxxxx>
    Cc: Jiri Pirko <jiri@xxxxxxxxxxx>
    Signed-off-by: Cong Wang <xiyou.wangcong@xxxxxxxxx>
    Link: https://patch.msgid.link/20250218043210.732959-4-xiyou.wangcong@xxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 7dfc7ac0624d8..ba437cfcbe90f 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -803,6 +803,7 @@ static void __skb_flow_bpf_to_target(const struct bpf_flow_keys *flow_keys,
 				     struct flow_dissector *flow_dissector,
 				     void *target_container)
 {
+	struct flow_dissector_key_ports_range *key_ports_range = NULL;
 	struct flow_dissector_key_ports *key_ports = NULL;
 	struct flow_dissector_key_control *key_control;
 	struct flow_dissector_key_basic *key_basic;
@@ -847,20 +848,21 @@ static void __skb_flow_bpf_to_target(const struct bpf_flow_keys *flow_keys,
 		key_control->addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS;
 	}
 
-	if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_PORTS))
+	if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_PORTS)) {
 		key_ports = skb_flow_dissector_target(flow_dissector,
 						      FLOW_DISSECTOR_KEY_PORTS,
 						      target_container);
-	else if (dissector_uses_key(flow_dissector,
-				    FLOW_DISSECTOR_KEY_PORTS_RANGE))
-		key_ports = skb_flow_dissector_target(flow_dissector,
-						      FLOW_DISSECTOR_KEY_PORTS_RANGE,
-						      target_container);
-
-	if (key_ports) {
 		key_ports->src = flow_keys->sport;
 		key_ports->dst = flow_keys->dport;
 	}
+	if (dissector_uses_key(flow_dissector,
+			       FLOW_DISSECTOR_KEY_PORTS_RANGE)) {
+		key_ports_range = skb_flow_dissector_target(flow_dissector,
+							    FLOW_DISSECTOR_KEY_PORTS_RANGE,
+							    target_container);
+		key_ports_range->tp.src = flow_keys->sport;
+		key_ports_range->tp.dst = flow_keys->dport;
+	}
 
 	if (dissector_uses_key(flow_dissector,
 			       FLOW_DISSECTOR_KEY_FLOW_LABEL)) {




[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