Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 May 2021 09:25:36 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: c82c200622b5 - main - Accessing the epoch structure should happen after the INIT_CHECK(). Else the epoch pointer may be NULL.
Message-ID:  <202105210925.14L9PahQ070819@gitrepo.freebsd.org>

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

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

commit c82c200622b5380b8346de29879222538653f663
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2021-05-21 09:06:27 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2021-05-21 09:21:32 +0000

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



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