git: 50c1e179b584 - main - umtx: handle allocation failire in umtx_pi_alloc()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 05 Jan 2025 18:21:02 UTC
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);