|
@@ -82,9 +82,12 @@ EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events);
|
|
int nf_conntrack_register_notifier(struct nf_ct_event_notifier *new)
|
|
int nf_conntrack_register_notifier(struct nf_ct_event_notifier *new)
|
|
{
|
|
{
|
|
int ret = 0;
|
|
int ret = 0;
|
|
|
|
+ struct nf_ct_event_notifier *notify;
|
|
|
|
|
|
mutex_lock(&nf_ct_ecache_mutex);
|
|
mutex_lock(&nf_ct_ecache_mutex);
|
|
- if (nf_conntrack_event_cb != NULL) {
|
|
|
|
|
|
+ notify = rcu_dereference_protected(nf_conntrack_event_cb,
|
|
|
|
+ lockdep_is_held(&nf_ct_ecache_mutex));
|
|
|
|
+ if (notify != NULL) {
|
|
ret = -EBUSY;
|
|
ret = -EBUSY;
|
|
goto out_unlock;
|
|
goto out_unlock;
|
|
}
|
|
}
|
|
@@ -100,8 +103,12 @@ EXPORT_SYMBOL_GPL(nf_conntrack_register_notifier);
|
|
|
|
|
|
void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *new)
|
|
void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *new)
|
|
{
|
|
{
|
|
|
|
+ struct nf_ct_event_notifier *notify;
|
|
|
|
+
|
|
mutex_lock(&nf_ct_ecache_mutex);
|
|
mutex_lock(&nf_ct_ecache_mutex);
|
|
- BUG_ON(nf_conntrack_event_cb != new);
|
|
|
|
|
|
+ notify = rcu_dereference_protected(nf_conntrack_event_cb,
|
|
|
|
+ lockdep_is_held(&nf_ct_ecache_mutex));
|
|
|
|
+ BUG_ON(notify != new);
|
|
rcu_assign_pointer(nf_conntrack_event_cb, NULL);
|
|
rcu_assign_pointer(nf_conntrack_event_cb, NULL);
|
|
mutex_unlock(&nf_ct_ecache_mutex);
|
|
mutex_unlock(&nf_ct_ecache_mutex);
|
|
}
|
|
}
|
|
@@ -110,9 +117,12 @@ EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier);
|
|
int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *new)
|
|
int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *new)
|
|
{
|
|
{
|
|
int ret = 0;
|
|
int ret = 0;
|
|
|
|
+ struct nf_exp_event_notifier *notify;
|
|
|
|
|
|
mutex_lock(&nf_ct_ecache_mutex);
|
|
mutex_lock(&nf_ct_ecache_mutex);
|
|
- if (nf_expect_event_cb != NULL) {
|
|
|
|
|
|
+ notify = rcu_dereference_protected(nf_expect_event_cb,
|
|
|
|
+ lockdep_is_held(&nf_ct_ecache_mutex));
|
|
|
|
+ if (notify != NULL) {
|
|
ret = -EBUSY;
|
|
ret = -EBUSY;
|
|
goto out_unlock;
|
|
goto out_unlock;
|
|
}
|
|
}
|
|
@@ -128,8 +138,12 @@ EXPORT_SYMBOL_GPL(nf_ct_expect_register_notifier);
|
|
|
|
|
|
void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *new)
|
|
void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *new)
|
|
{
|
|
{
|
|
|
|
+ struct nf_exp_event_notifier *notify;
|
|
|
|
+
|
|
mutex_lock(&nf_ct_ecache_mutex);
|
|
mutex_lock(&nf_ct_ecache_mutex);
|
|
- BUG_ON(nf_expect_event_cb != new);
|
|
|
|
|
|
+ notify = rcu_dereference_protected(nf_expect_event_cb,
|
|
|
|
+ lockdep_is_held(&nf_ct_ecache_mutex));
|
|
|
|
+ BUG_ON(notify != new);
|
|
rcu_assign_pointer(nf_expect_event_cb, NULL);
|
|
rcu_assign_pointer(nf_expect_event_cb, NULL);
|
|
mutex_unlock(&nf_ct_ecache_mutex);
|
|
mutex_unlock(&nf_ct_ecache_mutex);
|
|
}
|
|
}
|