summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac10
-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
3 files changed, 15 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 57c65e9..e3dc662 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
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));