Accessing the epoch structure should happen after the INIT_CHECK().

Else the epoch pointer may be NULL.

Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit c82c200622)
This commit is contained in:
Hans Petter Selasky 2021-05-21 11:06:27 +02:00
parent 8d8bfdf20d
commit 623d96f4af

View file

@ -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