|
@@ -293,6 +293,13 @@ static void nft_netdev_event(unsigned long event, struct net_device *dev,
|
|
|
if (strcmp(basechain->dev_name, dev->name) != 0)
|
|
|
return;
|
|
|
|
|
|
+ /* UNREGISTER events are also happpening on netns exit.
|
|
|
+ *
|
|
|
+ * Altough nf_tables core releases all tables/chains, only
|
|
|
+ * this event handler provides guarantee that
|
|
|
+ * basechain.ops->dev is still accessible, so we cannot
|
|
|
+ * skip exiting net namespaces.
|
|
|
+ */
|
|
|
__nft_release_basechain(ctx);
|
|
|
break;
|
|
|
case NETDEV_CHANGENAME:
|
|
@@ -318,10 +325,6 @@ static int nf_tables_netdev_event(struct notifier_block *this,
|
|
|
event != NETDEV_CHANGENAME)
|
|
|
return NOTIFY_DONE;
|
|
|
|
|
|
- ctx.net = maybe_get_net(ctx.net);
|
|
|
- if (!ctx.net)
|
|
|
- return NOTIFY_DONE;
|
|
|
-
|
|
|
mutex_lock(&ctx.net->nft.commit_mutex);
|
|
|
list_for_each_entry(table, &ctx.net->nft.tables, list) {
|
|
|
if (table->family != NFPROTO_NETDEV)
|
|
@@ -338,7 +341,6 @@ static int nf_tables_netdev_event(struct notifier_block *this,
|
|
|
}
|
|
|
}
|
|
|
mutex_unlock(&ctx.net->nft.commit_mutex);
|
|
|
- put_net(ctx.net);
|
|
|
|
|
|
return NOTIFY_DONE;
|
|
|
}
|