]> www.infradead.org Git - users/dwmw2/linux.git/commit
landlock: Use scoped guards for ruleset
authorMickaël Salaün <mic@digikod.net>
Mon, 13 Jan 2025 16:11:09 +0000 (17:11 +0100)
committerMickaël Salaün <mic@digikod.net>
Tue, 14 Jan 2025 10:57:45 +0000 (11:57 +0100)
commitd32f79a59ae1a90f27735c75f9920c585e6ceb8f
tree636927204ec52ca5c2dfca4f547554e6340859b4
parent25ccc75f5de6684fd6a497e44297497ccc7e0603
landlock: Use scoped guards for ruleset

Simplify error handling by replacing goto statements with automatic
calls to landlock_put_ruleset() when going out of scope.

This change will be easy to backport to v6.6 if needed, only the
kernel.h include line conflicts.  As for any other similar changes, we
should be careful when backporting without goto statements.

Add missing include file.

Reviewed-by: Günther Noack <gnoack@google.com>
Link: https://lore.kernel.org/r/20250113161112.452505-2-mic@digikod.net
Signed-off-by: Mickaël Salaün <mic@digikod.net>
security/landlock/ruleset.c
security/landlock/ruleset.h
security/landlock/syscalls.c