Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Jun 2021 12:24:47 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 623d96f4afb6 - stable/13 - Accessing the epoch structure should happen after the INIT_CHECK(). Else the epoch pointer may be NULL.
Message-ID:  <202106021224.152COl6c019073@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=623d96f4afb60eb0d6fcf5ba738d9880a3b10ca0

commit 623d96f4afb60eb0d6fcf5ba738d9880a3b10ca0
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2021-05-21 09:06:27 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2021-06-02 11:12:41 +0000

    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 c82c200622b5380b8346de29879222538653f663)
---
 sys/kern/subr_epoch.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/kern/subr_epoch.c b/sys/kern/subr_epoch.c
index 210cf78d55f0..31b79513fdc2 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106021224.152COl6c019073>