diff --git a/net/netfilter/nf_conntrack_proto.c b/net/netfilter/nf_conntrack_proto.c index 0afc298..941b5c3 100644 --- a/net/netfilter/nf_conntrack_proto.c +++ b/net/netfilter/nf_conntrack_proto.c @@ -173,7 +173,7 @@ static void nf_ct_l3proto_unregister_sys { #ifdef CONFIG_SYSCTL mutex_lock(&nf_ct_proto_sysctl_mutex); - if (l3proto->ctl_table != NULL) + if (l3proto->ctl_table_header != NULL) nf_ct_unregister_sysctl(&l3proto->ctl_table_header, l3proto->ctl_table, NULL); mutex_unlock(&nf_ct_proto_sysctl_mutex); @@ -260,7 +260,8 @@ static void nf_ct_l4proto_unregister_sys { #ifdef CONFIG_SYSCTL mutex_lock(&nf_ct_proto_sysctl_mutex); - if (l4proto->ctl_table != NULL) + if (l4proto->ctl_table_header != NULL && + *l4proto->ctl_table_header != NULL) nf_ct_unregister_sysctl(l4proto->ctl_table_header, l4proto->ctl_table, l4proto->ctl_table_users); diff --git a/net/netfilter/nf_sysctl.c b/net/netfilter/nf_sysctl.c index 18e0186..82af0d9 100644 --- a/net/netfilter/nf_sysctl.c +++ b/net/netfilter/nf_sysctl.c @@ -24,6 +24,8 @@ path_dup(struct ctl_table *path, struct struct ctl_table *t, *last = NULL, *tmp; for (t = path; t != NULL; t = t->child) { + /* twice the size since path elements are terminated by an + * empty element */ tmp = kmemdup(t, 2 * sizeof(*t), GFP_KERNEL); if (tmp == NULL) { if (last != NULL)