Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 06 May 2026 20:54:03 +0000
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 5df7dae10dc0 - main - kobj: Use M_WAITOK in kobj_init
Message-ID:  <69fbaa6b.22e4c.bfab97@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by jhb:

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

commit 5df7dae10dc02ade8639b0171e0d3cc8db790e41
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-05-06 20:53:46 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-05-06 20:53:46 +0000

    kobj: Use M_WAITOK in kobj_init
    
    Blocking allocation is safe in all of the current callers of kobj_init
    (most of them do a M_WAITOK malloc of the structure passed as the
    first argument to kobj_init just before calling it).  kobj_init
    doesn't return an error code but instead panics if the nested malloc
    in kobj_class_compile1 fails, so using M_WAITOK here is more robust.
    
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D56625
---
 sys/kern/subr_kobj.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/kern/subr_kobj.c b/sys/kern/subr_kobj.c
index 09fd730660c4..a88639289954 100644
--- a/sys/kern/subr_kobj.c
+++ b/sys/kern/subr_kobj.c
@@ -308,7 +308,7 @@ kobj_init(kobj_t obj, kobj_class_t cls)
 {
 	int error;
 
-	error = kobj_init1(obj, cls, M_NOWAIT);
+	error = kobj_init1(obj, cls, M_WAITOK);
 	if (error != 0)
 		panic("kobj_init1 failed: error %d", error);
 }


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69fbaa6b.22e4c.bfab97>