From b126a91f4b8bc97cb029e94e522e6119e49c50c9 Mon Sep 17 00:00:00 2001 From: backslashxx <118538522+backslashxx@users.noreply.github.com> Date: Wed, 13 Nov 2024 11:26:08 +0800 Subject: [PATCH] kernel: core_hook: upstream ksu_umount_mnt cherry picked from https://github.com/tiann/KernelSU/commit/898e9d4f8ca9b2f46b0c6b36b80a872b5b88d899 --- kernel/core_hook.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/kernel/core_hook.c b/kernel/core_hook.c index 07ad0b99f712..855d351d4840 100644 --- a/kernel/core_hook.c +++ b/kernel/core_hook.c @@ -499,14 +499,12 @@ static bool should_umount(struct path *path) return false; } -static int ksu_umount_mnt(struct path *path, int flags) +static void ksu_umount_mnt(struct path *path, int flags) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) || defined(KSU_UMOUNT) - return path_umount(path, flags); -#else - // TODO: umount for non GKI kernel - return -ENOSYS; -#endif + int err = path_umount(path, flags); + if (err) { + pr_info("umount %s failed: %d\n", path->dentry->d_iname, err); + } } static void try_umount(const char *mnt, bool check_mnt, int flags) @@ -527,10 +525,7 @@ static void try_umount(const char *mnt, bool check_mnt, int flags) return; } - err = ksu_umount_mnt(&path, flags); - if (err) { - pr_warn("umount %s failed: %d\n", mnt, err); - } + ksu_umount_mnt(&path, flags); } int ksu_handle_setuid(struct cred *new, const struct cred *old)