aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2021-05-21 09:06:27 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2021-05-21 09:21:32 +0000
commitc82c200622b5380b8346de29879222538653f663 (patch)
tree005fd8a4fd859fa3897c5fbb6e09cf25f2cf28ea
parentf33168351b3804664f5e82a409d9f956df2802f3 (diff)
Accessing the epoch structure should happen after the INIT_CHECK().
Else the epoch pointer may be NULL. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking
-rw-r--r--sys/kern/subr_epoch.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/subr_epoch.c b/sys/kern/subr_epoch.c
index c5e4b78d8b79..798dbdc4360e 100644
--- a/sys/kern/subr_epoch.c
+++ b/sys/kern/subr_epoch.c
@@ -442,13 +442,14 @@ _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et EPOCH_FILE_LINE)
struct thread *td;
MPASS(cold || epoch != NULL);
- MPASS(epoch->e_flags & EPOCH_PREEMPT);
td = curthread;
MPASS((vm_offset_t)et >= td->td_kstack &&
(vm_offset_t)et + sizeof(struct epoch_tracker) <=
td->td_kstack + td->td_kstack_pages * PAGE_SIZE);
INIT_CHECK(epoch);
+ MPASS(epoch->e_flags & EPOCH_PREEMPT);
+
#ifdef EPOCH_TRACE
epoch_trace_enter(td, epoch, et, file, line);
#endif