diff options
| author | Eric Dumazet <edumazet@google.com> | 2012-05-17 19:52:26 -0400 |
|---|---|---|
| committer | Luis Henriques <luis.henriques@canonical.com> | 2012-07-03 11:29:03 -0400 |
| commit | 82080f4405dac93d0671a6a60f50cd48e50f0fb9 (patch) | |
| tree | 88553380310174cb5cca1b710d30cc61ceae89a3 /net/core | |
| parent | 30373998a258ac08b36d7c12b47d961566b49bf4 (diff) | |
pktgen: fix module unload for good
BugLink: http://bugs.launchpad.net/bugs/1013748
[ Upstream commit d4b1133558e0d417342d5d2c49e4c35b428ff20d ]
commit c57b5468406 (pktgen: fix crash at module unload) did a very poor
job with list primitives.
1) list_splice() arguments were in the wrong order
2) list_splice(list, head) has undefined behavior if head is not
initialized.
3) We should use the list_splice_init() variant to clear pktgen_threads
list.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
Diffstat (limited to 'net/core')
| -rw-r--r-- | net/core/pktgen.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 0865ea025c9..c0e0f7679e7 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
| @@ -3755,13 +3755,13 @@ static void __exit pg_cleanup(void) | |||
| 3755 | { | 3755 | { |
| 3756 | struct pktgen_thread *t; | 3756 | struct pktgen_thread *t; |
| 3757 | struct list_head *q, *n; | 3757 | struct list_head *q, *n; |
| 3758 | struct list_head list; | 3758 | LIST_HEAD(list); |
| 3759 | 3759 | ||
| 3760 | /* Stop all interfaces & threads */ | 3760 | /* Stop all interfaces & threads */ |
| 3761 | pktgen_exiting = true; | 3761 | pktgen_exiting = true; |
| 3762 | 3762 | ||
| 3763 | mutex_lock(&pktgen_thread_lock); | 3763 | mutex_lock(&pktgen_thread_lock); |
| 3764 | list_splice(&list, &pktgen_threads); | 3764 | list_splice_init(&pktgen_threads, &list); |
| 3765 | mutex_unlock(&pktgen_thread_lock); | 3765 | mutex_unlock(&pktgen_thread_lock); |
| 3766 | 3766 | ||
| 3767 | list_for_each_safe(q, n, &list) { | 3767 | list_for_each_safe(q, n, &list) { |
