summaryrefslogtreecommitdiff
path: root/net/core/pktgen.c
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2012-05-14 16:41:02 -0700
committerColin Cross <ccross@android.com>2012-05-14 16:41:02 -0700
commitec0b571c19ac62ab0bb80d373a3d4922a48b4b75 (patch)
tree10c597f5227c969c3f2b909fbeb29725a0c5c6e8 /net/core/pktgen.c
parent7bb8b65407a519d3a90dd8cecdd1ccd10ee0c6cc (diff)
parent36be50515fe2aef61533b516fa2576a2c7fe7664 (diff)
Merge commit 'v3.4-rc7' into android-3.4
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 4d8ce93cd50..77a59980b57 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1931,7 +1931,7 @@ static int pktgen_device_event(struct notifier_block *unused,
{
struct net_device *dev = ptr;
- if (!net_eq(dev_net(dev), &init_net))
+ if (!net_eq(dev_net(dev), &init_net) || pktgen_exiting)
return NOTIFY_DONE;
/* It is OK that we do not hold the group lock right now,
@@ -3755,12 +3755,18 @@ static void __exit pg_cleanup(void)
{
struct pktgen_thread *t;
struct list_head *q, *n;
+ struct list_head list;
/* Stop all interfaces & threads */
pktgen_exiting = true;
- list_for_each_safe(q, n, &pktgen_threads) {
+ mutex_lock(&pktgen_thread_lock);
+ list_splice(&list, &pktgen_threads);
+ mutex_unlock(&pktgen_thread_lock);
+
+ list_for_each_safe(q, n, &list) {
t = list_entry(q, struct pktgen_thread, th_list);
+ list_del(&t->th_list);
kthread_stop(t->tsk);
kfree(t);
}