After the label is matched successful, any other levels judgements are meaningless. Therefore, add break to return early Signed-off-by: Cai Xinchen --- 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.18.0.huawei.25