]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
landlock: Remove incorrect warning
authorMickaël Salaün <mic@digikod.net>
Mon, 31 Mar 2025 10:47:07 +0000 (12:47 +0200)
committerMickaël Salaün <mic@digikod.net>
Tue, 8 Apr 2025 17:18:20 +0000 (19:18 +0200)
landlock_put_hierarchy() can be called when an error occurs in
landlock_merge_ruleset() due to insufficient memory.  In this case, the
domain's audit details might not have been allocated yet, which would
cause landlock_free_hierarchy_details() to print a warning (but still
safely handle this case).

We could keep the WARN_ON_ONCE(!hierarchy) but it's not worth it for
this kind of function, so let's remove it entirely.

Cc: Paul Moore <paul@paul-moore.com>
Reported-by: syzbot+8bca99e91de7e060e4ea@syzkaller.appspotmail.com
Link: https://lore.kernel.org/r/20250331104709.897062-1-mic@digikod.net
Reviewed-by: Günther Noack <gnoack@google.com>
Signed-off-by: Mickaël Salaün <mic@digikod.net>
security/landlock/domain.h

index ed0d348e214c9605133754ccf84e7d1575cace00..7fb70b25f85a19f1c3ec26e6a411a474877d9434 100644 (file)
@@ -130,7 +130,7 @@ int landlock_init_hierarchy_log(struct landlock_hierarchy *const hierarchy);
 static inline void
 landlock_free_hierarchy_details(struct landlock_hierarchy *const hierarchy)
 {
-       if (WARN_ON_ONCE(!hierarchy || !hierarchy->details))
+       if (!hierarchy || !hierarchy->details)
                return;
 
        put_pid(hierarchy->details->pid);