Patch "netfilter: ctnetlink: disable helper autoassign" 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

    netfilter: ctnetlink: disable helper autoassign

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:
     netfilter-ctnetlink-disable-helper-autoassign.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 6e18b8978fc67369a98f2e73e4f21cfa7cc9dd61
Author: Florian Westphal <fw@xxxxxxxxx>
Date:   Wed Feb 2 12:00:56 2022 +0100

    netfilter: ctnetlink: disable helper autoassign
    
    [ Upstream commit d1ca60efc53d665cf89ed847a14a510a81770b81 ]
    
    When userspace, e.g. conntrackd, inserts an entry with a specified helper,
    its possible that the helper is lost immediately after its added:
    
    ctnetlink_create_conntrack
      -> nf_ct_helper_ext_add + assign helper
        -> ctnetlink_setup_nat
          -> ctnetlink_parse_nat_setup
             -> parse_nat_setup -> nfnetlink_parse_nat_setup
                                   -> nf_nat_setup_info
                                     -> nf_conntrack_alter_reply
                                       -> __nf_ct_try_assign_helper
    
    ... and __nf_ct_try_assign_helper will zero the helper again.
    
    Set IPS_HELPER bit to bypass auto-assign logic, its unwanted, just like
    when helper is assigned via ruleset.
    
    Dropped old 'not strictly necessary' comment, it referred to use of
    rcu_assign_pointer() before it got replaced by RCU_INIT_POINTER().
    
    NB: Fixes tag intentionally incorrect, this extends the referenced commit,
    but this change won't build without IPS_HELPER introduced there.
    
    Fixes: 6714cf5465d280 ("netfilter: nf_conntrack: fix explicit helper attachment and NAT")
    Reported-by: Pham Thanh Tuyen <phamtyn@xxxxxxxxx>
    Signed-off-by: Florian Westphal <fw@xxxxxxxxx>
    Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/uapi/linux/netfilter/nf_conntrack_common.h b/include/uapi/linux/netfilter/nf_conntrack_common.h
index 4b3395082d15c..26071021e986f 100644
--- a/include/uapi/linux/netfilter/nf_conntrack_common.h
+++ b/include/uapi/linux/netfilter/nf_conntrack_common.h
@@ -106,7 +106,7 @@ enum ip_conntrack_status {
 	IPS_NAT_CLASH = IPS_UNTRACKED,
 #endif
 
-	/* Conntrack got a helper explicitly attached via CT target. */
+	/* Conntrack got a helper explicitly attached (ruleset, ctnetlink). */
 	IPS_HELPER_BIT = 13,
 	IPS_HELPER = (1 << IPS_HELPER_BIT),
 
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index c6bcc28ae3387..eeeaa34b3e7b5 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -2283,7 +2283,8 @@ ctnetlink_create_conntrack(struct net *net,
 			if (helper->from_nlattr)
 				helper->from_nlattr(helpinfo, ct);
 
-			/* not in hash table yet so not strictly necessary */
+			/* disable helper auto-assignment for this entry */
+			ct->status |= IPS_HELPER;
 			RCU_INIT_POINTER(help->helper, helper);
 		}
 	} else {



[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