diff options
author | qingli <qingli@FreeBSD.org> | 2009-10-20 21:27:03 +0000 |
---|---|---|
committer | qingli <qingli@FreeBSD.org> | 2009-10-20 21:27:03 +0000 |
commit | 88bb68ef0fa02ace95d7e28627b5552b1888ba4b (patch) | |
tree | b85f15f4627414cbce376c8e2d0f6f5348b4feae /sys/net/flowtable.c | |
parent | d07399d06adff699d4d6eefecba79ce65c327048 (diff) | |
download | FreeBSD-src-88bb68ef0fa02ace95d7e28627b5552b1888ba4b.zip FreeBSD-src-88bb68ef0fa02ace95d7e28627b5552b1888ba4b.tar.gz |
The flow-table function flowtable_route_flush() may be called
during system initialization time. Since the flow-table is
designed to maintain per CPU flow cache, the existing code
did not check whether "smp_started" is true before calling
sched_bind() and sched_unbind(), which triggers a page fault.
Reviewed by: jeff
MFC after: immediately
Diffstat (limited to 'sys/net/flowtable.c')
-rw-r--r-- | sys/net/flowtable.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sys/net/flowtable.c b/sys/net/flowtable.c index b85ae26..31c2acc 100644 --- a/sys/net/flowtable.c +++ b/sys/net/flowtable.c @@ -930,16 +930,20 @@ flowtable_route_flush(struct flowtable *ft, struct rtentry *rt) for (i = 0; i <= mp_maxid; i++) { if (CPU_ABSENT(i)) continue; - - thread_lock(curthread); - sched_bind(curthread, i); - thread_unlock(curthread); + + if (smp_started == 1) { + thread_lock(curthread); + sched_bind(curthread, i); + thread_unlock(curthread); + } flowtable_free_stale(ft, rt); - thread_lock(curthread); - sched_unbind(curthread); - thread_unlock(curthread); + if (smp_started == 1) { + thread_lock(curthread); + sched_unbind(curthread); + thread_unlock(curthread); + } } } else { flowtable_free_stale(ft, rt); |