summaryrefslogtreecommitdiffstats
path: root/net/core/pktgen.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2012-05-17 23:52:26 +0000
committerDavid S. Miller <davem@davemloft.net>2012-05-18 13:54:33 -0400
commitd4b1133558e0d417342d5d2c49e4c35b428ff20d (patch)
tree8d50b39901dbcd06d181ad505f7aff76ca9388d7 /net/core/pktgen.c
parent42ea7d7f2a7356962022cdd124d9043c488ca5e2 (diff)
downloadblackbird-op-linux-d4b1133558e0d417342d5d2c49e4c35b428ff20d.tar.gz
blackbird-op-linux-d4b1133558e0d417342d5d2c49e4c35b428ff20d.zip
pktgen: fix module unload for good
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>
Diffstat (limited to 'net/core/pktgen.c')
-rw-r--r--net/core/pktgen.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 77a59980b579..b81369b6ddc0 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3755,13 +3755,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) {
OpenPOWER on IntegriCloud