diff options
author | Eric Dumazet <edumazet@google.com> | 2012-05-17 23:52:26 +0000 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2012-05-20 22:56:53 +0100 |
commit | ef6bdf34a4d247f48a9c103375fd2927d7df91e7 (patch) | |
tree | cebaa6ca9eec7480bf9ea71baa9acddd94d47ef2 /net | |
parent | 03f3b8447061afb212e374e274b0b799c0776e3f (diff) |
pktgen: fix module unload for good
commit d4b1133558e0d417342d5d2c49e4c35b428ff20d upstream.
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: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'net')
-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 657e5f91975..df878de7c6e 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -3758,13 +3758,13 @@ static void __exit pg_cleanup(void) { struct pktgen_thread *t; struct list_head *q, *n; - struct list_head list; + LIST_HEAD(list); /* Stop all interfaces & threads */ pktgen_exiting = true; mutex_lock(&pktgen_thread_lock); - list_splice(&list, &pktgen_threads); + list_splice_init(&pktgen_threads, &list); mutex_unlock(&pktgen_thread_lock); list_for_each_safe(q, n, &list) { |