Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Jan 2025 18:21:02 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 50c1e179b584 - main - umtx: handle allocation failire in umtx_pi_alloc()
Message-ID:  <202501051821.505IL2EN044053@gitrepo.freebsd.org>

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

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

commit 50c1e179b584f43ba82e9afc91b25ec4831b58ef
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-01-05 16:09:08 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-01-05 17:19:56 +0000

    umtx: handle allocation failire in umtx_pi_alloc()
    
    Don't assume that this allocation will succeed. We may have been passed
    M_NOWAIT.
    
    The calling code already handles allocation failures, but the function
    itself did not.
    
    PR:             283807
    MFC after:      1 week
---
 sys/kern/kern_umtx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c
index c4a820f41bc3..a9294c324cb4 100644
--- a/sys/kern/kern_umtx.c
+++ b/sys/kern/kern_umtx.c
@@ -1740,6 +1740,9 @@ umtx_pi_alloc(int flags)
 	struct umtx_pi *pi;
 
 	pi = uma_zalloc(umtx_pi_zone, M_ZERO | flags);
+	if (pi == NULL)
+		return (NULL);
+
 	TAILQ_INIT(&pi->pi_blocked);
 	atomic_add_int(&umtx_pi_allocated, 1);
 	return (pi);



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