[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20260119091226.3195309-1-caixinchen1@huawei.com>
Date: Mon, 19 Jan 2026 09:12:26 +0000
From: Cai Xinchen <caixinchen1@...wei.com>
To: <nicolas.bouchinet@....cyber.gouv.fr>, <xiujianfeng@...wei.com>,
<paul@...l-moore.com>, <jmorris@...ei.org>, <serge@...lyn.com>
CC: <linux-security-module@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<caixinchen1@...wei.com>
Subject: [PATCH -next] lockdown: Add break in lockdown_write
After the label is matched successful, any other levels judgements
are meaningless. Therefore, add break to return early
Signed-off-by: Cai Xinchen <caixinchen1@...wei.com>
---
security/lockdown/lockdown.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/security/lockdown/lockdown.c b/security/lockdown/lockdown.c
index 8d46886d2cca..263dcc80d839 100644
--- a/security/lockdown/lockdown.c
+++ b/security/lockdown/lockdown.c
@@ -139,8 +139,10 @@ static ssize_t lockdown_write(struct file *file, const char __user *buf,
enum lockdown_reason level = lockdown_levels[i];
const char *label = lockdown_reasons[level];
- if (label && !strcmp(state, label))
+ if (label && !strcmp(state, label)) {
err = lock_kernel_down("securityfs", level);
+ break;
+ }
}
kfree(state);
--
2.34.1
Powered by blists - more mailing lists