]> git.ipfire.org Git - thirdparty/ipset.git/commitdiff
Handle "netfilter: ipset: Fix for recursive locking warning" patch for backward compa...
authorJozsef Kadlecsik <kadlec@netfilter.org>
Thu, 19 Dec 2024 09:54:23 +0000 (10:54 +0100)
committerJozsef Kadlecsik <kadlec@netfilter.org>
Thu, 19 Dec 2024 09:54:23 +0000 (10:54 +0100)
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
configure.ac
kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
kernel/net/netfilter/ipset/ip_set_list_set.c

index 57c65e905da635fefc6a1e3d14eb0f3c807a2c74..e3dc6620437e4f8d98be75b61acd2e6f81fc1f5f 100644 (file)
@@ -909,6 +909,16 @@ else
        AC_SUBST(HAVE_RCUPDATE_WAIT_H, undef)
 fi
 
+AC_MSG_CHECKING([kernel source for lockdep_set_class in lockdep.h])
+if test -f $ksourcedir/include/linux/lockdep.h && \
+   $GREP -q 'define lockdep_set_class' $ksourcedir/include/linux/lockdep.h; then
+       AC_MSG_RESULT(yes)
+       AC_SUBST(HAVE_LOCKDEP_SET_CLASS, define)
+else
+       AC_MSG_RESULT(no)
+       AC_SUBST(HAVE_LOCKDEP_SET_CLASS, undef)
+fi
+
 AC_MSG_CHECKING([kernel source for struct net_generic])
 if test -f $ksourcedir/include/net/netns/generic.h && \
    $GREP -q 'struct net_generic' $ksourcedir/include/net/netns/generic.h; then
index 3a0e0b415f1551b9eb9b5a4087fac772d01ca650..32a8348804f0b2c6b27f86fdc99b1ccd11c22834 100644 (file)
@@ -71,6 +71,7 @@
 #@HAVE_NLMSG_UNICAST@ HAVE_NLMSG_UNICAST
 #@HAVE_NF_BRIDGE_GET_PYSINDEV_NET@ HAVE_NF_BRIDGE_GET_PYSINDEV_NET
 #@HAVE_RCUPDATE_WAIT_H@ HAVE_RCUPDATE_WAIT_H
+#@HAVE_LOCKDEP_SET_CLASS@ HAVE_LOCKDEP_SET_CLASS
 
 #ifdef HAVE_EXPORT_SYMBOL_GPL_IN_MODULE_H
 #include <linux/module.h>
index b286a62644e2438a1edad039051cb7bf0613fe85..0162e1d03706c5980770ce28dcf1802cdb2a5469 100644 (file)
@@ -615,7 +615,9 @@ init_list_set(struct net *net, struct ip_set *set, u32 size)
        return true;
 }
 
+#ifdef HAVE_LOCKDEP_SET_CLASS
 static struct lock_class_key list_set_lockdep_key;
+#endif
 
 static int
 list_set_create(struct net *net, struct ip_set *set, struct nlattr *tb[],
@@ -633,7 +635,9 @@ list_set_create(struct net *net, struct ip_set *set, struct nlattr *tb[],
        if (size < IP_SET_LIST_MIN_SIZE)
                size = IP_SET_LIST_MIN_SIZE;
 
+#ifdef HAVE_LOCKDEP_SET_CLASS
        lockdep_set_class(&set->lock, &list_set_lockdep_key);
+#endif
        set->variant = &set_variant;
        set->dsize = ip_set_elem_len(set, tb, sizeof(struct set_elem),
                                     __alignof__(struct set_elem));