kernel: truncate allowlist before save

This commit is contained in:
weishu
2023-12-29 18:32:37 +08:00
parent fbeea49318
commit 32b3ec9844

View File

@@ -351,7 +351,7 @@ void do_save_allow_list(struct work_struct *work)
loff_t off = 0; loff_t off = 0;
struct file *fp = 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)) { if (IS_ERR(fp)) {
pr_err("save_allow_list create file failed: %ld\n", PTR_ERR(fp)); pr_err("save_allow_list create file failed: %ld\n", PTR_ERR(fp));
return; return;