Patch "netfilter: ctnetlink: compile ctnetlink_label_size with CONFIG_NF_CONNTRACK_EVENTS" has been added to the 6.6-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: compile ctnetlink_label_size with CONFIG_NF_CONNTRACK_EVENTS

to the 6.6-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-compile-ctnetlink_label_size-wit.patch
and it can be found in the queue-6.6 subdirectory.

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



commit 96b5bebfff759cac44233d2b40cef5da694567db
Author: Simon Horman <horms@xxxxxxxxxx>
Date:   Mon Sep 16 16:14:41 2024 +0100

    netfilter: ctnetlink: compile ctnetlink_label_size with CONFIG_NF_CONNTRACK_EVENTS
    
    [ Upstream commit e1f1ee0e9ad8cbe660f5c104e791c5f1a7cf4c31 ]
    
    Only provide ctnetlink_label_size when it is used,
    which is when CONFIG_NF_CONNTRACK_EVENTS is configured.
    
    Flagged by clang-18 W=1 builds as:
    
    .../nf_conntrack_netlink.c:385:19: warning: unused function 'ctnetlink_label_size' [-Wunused-function]
      385 | static inline int ctnetlink_label_size(const struct nf_conn *ct)
          |                   ^~~~~~~~~~~~~~~~~~~~
    
    The condition on CONFIG_NF_CONNTRACK_LABELS being removed by
    this patch guards compilation of non-trivial implementations
    of ctnetlink_dump_labels() and ctnetlink_label_size().
    
    However, this is not necessary as each of these functions
    will always return 0 if CONFIG_NF_CONNTRACK_LABELS is not defined
    as each function starts with the equivalent of:
    
            struct nf_conn_labels *labels = nf_ct_labels_find(ct);
    
            if (!labels)
                    return 0;
    
    And nf_ct_labels_find always returns NULL if CONFIG_NF_CONNTRACK_LABELS
    is not enabled.  So I believe that the compiler optimises the code away
    in such cases anyway.
    
    Found by inspection.
    Compile tested only.
    
    Originally splitted in two patches, Pablo Neira Ayuso collapsed them and
    added Fixes: tag.
    
    Fixes: 0ceabd83875b ("netfilter: ctnetlink: deliver labels to userspace")
    Link: https://lore.kernel.org/netfilter-devel/20240909151712.GZ2097826@xxxxxxxxxx/
    Signed-off-by: Simon Horman <horms@xxxxxxxxxx>
    Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 4dab45039f349..282e9644f6fdd 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -381,7 +381,7 @@ static int ctnetlink_dump_secctx(struct sk_buff *skb, const struct nf_conn *ct)
 #define ctnetlink_dump_secctx(a, b) (0)
 #endif
 
-#ifdef CONFIG_NF_CONNTRACK_LABELS
+#ifdef CONFIG_NF_CONNTRACK_EVENTS
 static inline int ctnetlink_label_size(const struct nf_conn *ct)
 {
 	struct nf_conn_labels *labels = nf_ct_labels_find(ct);
@@ -390,6 +390,7 @@ static inline int ctnetlink_label_size(const struct nf_conn *ct)
 		return 0;
 	return nla_total_size(sizeof(labels->bits));
 }
+#endif
 
 static int
 ctnetlink_dump_labels(struct sk_buff *skb, const struct nf_conn *ct)
@@ -410,10 +411,6 @@ ctnetlink_dump_labels(struct sk_buff *skb, const struct nf_conn *ct)
 
 	return 0;
 }
-#else
-#define ctnetlink_dump_labels(a, b) (0)
-#define ctnetlink_label_size(a)	(0)
-#endif
 
 #define master_tuple(ct) &(ct->master->tuplehash[IP_CT_DIR_ORIGINAL].tuple)
 




[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