kernel: fix incorrect umount for apps

This commit is contained in:
weishu
2023-06-22 15:17:32 +08:00
parent e17f3eab96
commit f5cfb32882

View File

@@ -475,12 +475,7 @@ static bool should_umount(struct path *path)
if (path->mnt && path->mnt->mnt_sb && path->mnt->mnt_sb->s_type) { if (path->mnt && path->mnt->mnt_sb && path->mnt->mnt_sb->s_type) {
const char *fstype = path->mnt->mnt_sb->s_type->name; const char *fstype = path->mnt->mnt_sb->s_type->name;
if (strcmp(fstype, "overlay") == 0) { return strcmp(fstype, "overlay") == 0;
return ksu_uid_should_umount(current_uid().val);
}
#ifdef CONFIG_KSU_DEBUG
pr_info("uid: %d should not umount!\n", current_uid().val);
#endif
} }
return false; return false;
} }
@@ -532,6 +527,14 @@ int ksu_handle_setuid(struct cred *new, const struct cred *old)
return 0; return 0;
} }
if (!ksu_uid_should_umount(new_uid.val)) {
return 0;
} else {
#ifdef CONFIG_KSU_DEBUG
pr_info("uid: %d should not umount!\n", current_uid().val);
#endif
}
// umount the target mnt // umount the target mnt
pr_info("handle umount for uid: %d\n", new_uid.val); pr_info("handle umount for uid: %d\n", new_uid.val);