The branch main has been updated by markj:

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

commit a4955b0143361900140df640d116891f047f5431
Author:     Mark Johnston <[email protected]>
AuthorDate: 2026-01-15 13:50:43 +0000
Commit:     Mark Johnston <[email protected]>
CommitDate: 2026-01-15 13:50:43 +0000

    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 <[email protected]>
    Reviewed by:    emaste
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D54671
---
 sys/compat/linuxkpi/common/src/linux_current.c | 10 ++--------
 1 file 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);
                }
 

Reply via email to