summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.18/0054-pktgen-fix-crash-at-module-unload.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.18/0054-pktgen-fix-crash-at-module-unload.patch')
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.18/0054-pktgen-fix-crash-at-module-unload.patch72
1 files changed, 72 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.18/0054-pktgen-fix-crash-at-module-unload.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.18/0054-pktgen-fix-crash-at-module-unload.patch
new file mode 100644
index 00000000..3d38f55f
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.18/0054-pktgen-fix-crash-at-module-unload.patch
@@ -0,0 +1,72 @@
1From 0db05d78c77595936a7494aa049850169c49b861 Mon Sep 17 00:00:00 2001
2From: Eric Dumazet <eric.dumazet@gmail.com>
3Date: Wed, 9 May 2012 13:29:51 +0000
4Subject: [PATCH 54/56] pktgen: fix crash at module unload
5
6commit c57b54684060c8aced64a5b78ff69ff289af97b9 upstream.
7
8commit 7d3d43dab4e9 (net: In unregister_netdevice_notifier unregister
9the netdevices.) makes pktgen crashing at module unload.
10
11[ 296.820578] BUG: spinlock bad magic on CPU#6, rmmod/3267
12[ 296.820719] lock: ffff880310c38000, .magic: ffff8803, .owner: <none>/-1, .owner_cpu: -1
13[ 296.820943] Pid: 3267, comm: rmmod Not tainted 3.4.0-rc5+ #254
14[ 296.821079] Call Trace:
15[ 296.821211] [<ffffffff8168a715>] spin_dump+0x8a/0x8f
16[ 296.821345] [<ffffffff8168a73b>] spin_bug+0x21/0x26
17[ 296.821507] [<ffffffff812b4741>] do_raw_spin_lock+0x131/0x140
18[ 296.821648] [<ffffffff8169188e>] _raw_spin_lock+0x1e/0x20
19[ 296.821786] [<ffffffffa00cc0fd>] __pktgen_NN_threads+0x4d/0x140 [pktgen]
20[ 296.821928] [<ffffffffa00ccf8d>] pktgen_device_event+0x10d/0x1e0 [pktgen]
21[ 296.822073] [<ffffffff8154ed4f>] unregister_netdevice_notifier+0x7f/0x100
22[ 296.822216] [<ffffffffa00d2a0b>] pg_cleanup+0x48/0x73 [pktgen]
23[ 296.822357] [<ffffffff8109528e>] sys_delete_module+0x17e/0x2a0
24[ 296.822502] [<ffffffff81699652>] system_call_fastpath+0x16/0x1b
25
26Hold the pktgen_thread_lock while splicing pktgen_threads, and test
27pktgen_exiting in pktgen_device_event() to make unload faster.
28
29Signed-off-by: Eric Dumazet <edumazet@google.com>
30Cc: Eric W. Biederman <ebiederm@xmission.com>
31Signed-off-by: David S. Miller <davem@davemloft.net>
32Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
33---
34 net/core/pktgen.c | 10 ++++++++--
35 1 files changed, 8 insertions(+), 2 deletions(-)
36
37diff --git a/net/core/pktgen.c b/net/core/pktgen.c
38index 0001c24..657e5f9 100644
39--- a/net/core/pktgen.c
40+++ b/net/core/pktgen.c
41@@ -1932,7 +1932,7 @@ static int pktgen_device_event(struct notifier_block *unused,
42 {
43 struct net_device *dev = ptr;
44
45- if (!net_eq(dev_net(dev), &init_net))
46+ if (!net_eq(dev_net(dev), &init_net) || pktgen_exiting)
47 return NOTIFY_DONE;
48
49 /* It is OK that we do not hold the group lock right now,
50@@ -3758,12 +3758,18 @@ static void __exit pg_cleanup(void)
51 {
52 struct pktgen_thread *t;
53 struct list_head *q, *n;
54+ struct list_head list;
55
56 /* Stop all interfaces & threads */
57 pktgen_exiting = true;
58
59- list_for_each_safe(q, n, &pktgen_threads) {
60+ mutex_lock(&pktgen_thread_lock);
61+ list_splice(&list, &pktgen_threads);
62+ mutex_unlock(&pktgen_thread_lock);
63+
64+ list_for_each_safe(q, n, &list) {
65 t = list_entry(q, struct pktgen_thread, th_list);
66+ list_del(&t->th_list);
67 kthread_stop(t->tsk);
68 kfree(t);
69 }
70--
711.7.7.6
72