Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 May 2021 12:40:50 GMT
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 8252fe56a0ed - main - cam: Fix race condition in dainit()
Message-ID:  <202105161240.14GCeoNl047749@gitrepo.freebsd.org>

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

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

commit 8252fe56a0edc95f55b203424a8f2f957959e7a4
Author:     Edward Tomasz Napierala <trasz@FreeBSD.org>
AuthorDate: 2021-05-16 09:35:31 +0000
Commit:     Edward Tomasz Napierala <trasz@FreeBSD.org>
CommitDate: 2021-05-16 12:36:54 +0000

    cam: Fix race condition in dainit()
    
    Previously, daregister() could have been called before dainit()
    initialized the UMA zone.  This would trip a KASSERT.
    
    Reported By:    pho
    Tested By:      pho
    Sponsored by:   NetApp, Inc.
    Sponsored by:   Klara, Inc.
---
 sys/cam/scsi/scsi_da.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index 05dd9b6e7566..cf6e2e17e410 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -2001,6 +2001,10 @@ dainit(void)
 {
 	cam_status status;
 
+	da_ccb_zone = uma_zcreate("da_ccb",
+	    sizeof(struct ccb_scsiio), NULL, NULL, NULL, NULL,
+	    UMA_ALIGN_PTR, 0);
+
 	/*
 	 * Install a global async callback.  This callback will
 	 * receive async callbacks like "new device found".
@@ -2016,10 +2020,6 @@ dainit(void)
 					   NULL, SHUTDOWN_PRI_DEFAULT)) == NULL)
 		    printf("dainit: shutdown event registration failed!\n");
 	}
-
-	da_ccb_zone = uma_zcreate("da_ccb",
-	    sizeof(struct ccb_scsiio), NULL, NULL, NULL, NULL,
-	    UMA_ALIGN_PTR, 0);
 }
 
 /*



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