git: 2e2c4e312ef1 - stable/14 - umtx: handle allocation failire in umtx_pi_alloc()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 12 Jan 2025 10:20:29 UTC
The branch stable/14 has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=2e2c4e312ef1adfc21f7f8264082b3027f7a1931
commit 2e2c4e312ef1adfc21f7f8264082b3027f7a1931
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-01-05 16:09:08 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-01-12 09:47:03 +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
(cherry picked from commit 50c1e179b584f43ba82e9afc91b25ec4831b58ef)
---
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 0ba0876bfb1f..7cfe68730e7d 100644
--- a/sys/kern/kern_umtx.c
+++ b/sys/kern/kern_umtx.c
@@ -1739,6 +1739,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);