aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2026-01-15 13:50:43 +0000
committerMark Johnston <markj@FreeBSD.org>2026-01-15 13:50:43 +0000
commita4955b0143361900140df640d116891f047f5431 (patch)
treeb1a5046b5020fde4a18e6c0dea1b1faba1ecc0eb
parent9d015a916745e320aed50fc759f111fc7622e427 (diff)
linuxkpi: Fix an error path in linux_alloc_current()
If the allocation fails we should free the task struct. While here get rid of a couple of unnecessary assertions. Reported by: Kevin Day <kevin@your.org> Reviewed by: emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D54671
-rw-r--r--sys/compat/linuxkpi/common/src/linux_current.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/sys/compat/linuxkpi/common/src/linux_current.c b/sys/compat/linuxkpi/common/src/linux_current.c
index c342eb279caa..3bc5d31d211a 100644
--- a/sys/compat/linuxkpi/common/src/linux_current.c
+++ b/sys/compat/linuxkpi/common/src/linux_current.c
@@ -90,11 +90,8 @@ linux_alloc_current(struct thread *td, int flags)
}
ts = uma_zalloc(linux_current_zone, flags | M_ZERO);
- if (ts == NULL) {
- if ((flags & (M_WAITOK | M_NOWAIT)) == M_WAITOK)
- panic("linux_alloc_current: failed to allocate task");
+ if (ts == NULL)
return (ENOMEM);
- }
mm = NULL;
/* setup new task structure */
@@ -118,10 +115,7 @@ linux_alloc_current(struct thread *td, int flags)
PROC_UNLOCK(proc);
mm = uma_zalloc(linux_mm_zone, flags | M_ZERO);
if (mm == NULL) {
- if ((flags & (M_WAITOK | M_NOWAIT)) == M_WAITOK)
- panic(
- "linux_alloc_current: failed to allocate mm");
- uma_zfree(linux_current_zone, mm);
+ uma_zfree(linux_current_zone, ts);
return (ENOMEM);
}