aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/pktgen.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-05-16 22:17:37 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-16 22:17:37 -0400
commit028940342a906db8da014a7603a0deddc2c323dd (patch)
tree688dbc38a3e218f2493d311b1d70a67668837347 /net/core/pktgen.c
parentbe3eed2e96340d3c7a4d1ea1d63e7bd6095d1e34 (diff)
parent0e93b4b304ae052ba1bc73f6d34a68556fe93429 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'net/core/pktgen.c')
-rw-r--r--net/core/pktgen.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 33912573959d..70236db0fb4f 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1931,7 +1931,7 @@ static int pktgen_device_event(struct notifier_block *unused,
1931{ 1931{
1932 struct net_device *dev = ptr; 1932 struct net_device *dev = ptr;
1933 1933
1934 if (!net_eq(dev_net(dev), &init_net)) 1934 if (!net_eq(dev_net(dev), &init_net) || pktgen_exiting)
1935 return NOTIFY_DONE; 1935 return NOTIFY_DONE;
1936 1936
1937 /* It is OK that we do not hold the group lock right now, 1937 /* It is OK that we do not hold the group lock right now,
@@ -3754,12 +3754,18 @@ static void __exit pg_cleanup(void)
3754{ 3754{
3755 struct pktgen_thread *t; 3755 struct pktgen_thread *t;
3756 struct list_head *q, *n; 3756 struct list_head *q, *n;
3757 struct list_head list;
3757 3758
3758 /* Stop all interfaces & threads */ 3759 /* Stop all interfaces & threads */
3759 pktgen_exiting = true; 3760 pktgen_exiting = true;
3760 3761
3761 list_for_each_safe(q, n, &pktgen_threads) { 3762 mutex_lock(&pktgen_thread_lock);
3763 list_splice(&list, &pktgen_threads);
3764 mutex_unlock(&pktgen_thread_lock);
3765
3766 list_for_each_safe(q, n, &list) {
3762 t = list_entry(q, struct pktgen_thread, th_list); 3767 t = list_entry(q, struct pktgen_thread, th_list);
3768 list_del(&t->th_list);
3763 kthread_stop(t->tsk); 3769 kthread_stop(t->tsk);
3764 kfree(t); 3770 kfree(t);
3765 } 3771 }