summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fastd.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fastd.c b/fastd.c
index 505bba5..98b6565 100644
--- a/fastd.c
+++ b/fastd.c
@@ -54,6 +54,7 @@
#include <linux/netdevice.h>
#include <linux/rculist.h>
#include <net/genetlink.h>
+#include <net/net_namespace.h>
#include <net/route.h>
#include "fastd.h"
@@ -71,6 +72,8 @@ struct fastd_struct {
struct list_head list;
struct net_device *dev;
+
+ struct net *net;
u32 owner;
u16 mode;
@@ -103,7 +106,7 @@ static int fastd_nl_event(struct notifier_block *nb,
rcu_read_lock();
list_for_each_entry_rcu(entry, &fastd_list, list) {
- if (entry->owner == n->portid) {
+ if (net_eq(entry->net, n->net) && entry->owner == n->portid) {
entry->owner = 0;
queue_work(fastd_workqueue, &entry->destroy_work);
@@ -158,7 +161,11 @@ static const struct ethtool_ops fastd_ethtool_ops = {
static void fastd_netdev_free(struct net_device *dev) {
+ struct fastd_struct *fastd = netdev_priv(dev);
+
+ put_net(fastd->net);
free_netdev(dev);
+
module_put(THIS_MODULE);
}
@@ -244,6 +251,7 @@ static int fastd_cmd_create(struct sk_buff *skb, struct genl_info *info)
fastd = netdev_priv(dev);
fastd->dev = dev;
+ fastd->net = get_net(net);
fastd->owner = info->snd_portid;
fastd->mode = mode;
INIT_WORK(&fastd->destroy_work, fastd_destroy_work);