From 32b3ec9844f8c1642346e3fd8c215d5f152e5b4f Mon Sep 17 00:00:00 2001 From: weishu Date: Fri, 29 Dec 2023 18:32:37 +0800 Subject: [PATCH] kernel: truncate allowlist before save --- kernel/allowlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/allowlist.c b/kernel/allowlist.c index 2c32bbb5..644191ca 100644 --- a/kernel/allowlist.c +++ b/kernel/allowlist.c @@ -351,7 +351,7 @@ void do_save_allow_list(struct work_struct *work) loff_t off = 0; struct file *fp = - ksu_filp_open_compat(KERNEL_SU_ALLOWLIST, O_WRONLY | O_CREAT, 0644); + ksu_filp_open_compat(KERNEL_SU_ALLOWLIST, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (IS_ERR(fp)) { pr_err("save_allow_list create file failed: %ld\n", PTR_ERR(fp)); return;