summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@netfilter.org>2024-12-19 10:54:23 +0100
committerJozsef Kadlecsik <kadlec@netfilter.org>2024-12-19 10:54:23 +0100
commit210e4491798d6fa0e7ea4a8e74307db8809d6cfe (patch)
tree429c9391a0bae00f3e9bb1cea6238a19bd454d91 /kernel
parentcee6ea289ad448aa8d8e3fb4aa64cf6cb6c3aea4 (diff)
Handle "netfilter: ipset: Fix for recursive locking warning" patch for backward compatibility
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/include/linux/netfilter/ipset/ip_set_compat.h.in1
-rw-r--r--kernel/net/netfilter/ipset/ip_set_list_set.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in b/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
index 3a0e0b4..32a8348 100644
--- a/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
+++ b/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
@@ -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>
diff --git a/kernel/net/netfilter/ipset/ip_set_list_set.c b/kernel/net/netfilter/ipset/ip_set_list_set.c
index b286a62..0162e1d 100644
--- a/kernel/net/netfilter/ipset/ip_set_list_set.c
+++ b/kernel/net/netfilter/ipset/ip_set_list_set.c
@@ -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));