Skip to content

Commit c1c8612

Browse files
committed
kernel: core_hook: tweak and rename path_umount handler
rename function to ksu_path_umount to clearly differntiate it from sys_umount. Pass mnt string directly to avoid redundant resolution for debug logging. Small touches, to make it neater. - also fix missed path_put Signed-off-by: backslashxx <[email protected]>
1 parent 6cb49f1 commit c1c8612

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

kernel/core_hook.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <linux/mount.h>
1717
#include <linux/fs.h>
1818
#include <linux/namei.h>
19-
#ifndef KSU_HAS_PATH_UMOUNT
19+
#if !(LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)) && !defined(KSU_HAS_PATH_UMOUNT)
2020
#include <linux/syscalls.h> // sys_umount
2121
#endif
2222

@@ -510,13 +510,11 @@ static bool should_umount(struct path *path)
510510
return false;
511511
}
512512

513-
#ifdef KSU_HAS_PATH_UMOUNT
514-
static void ksu_umount_mnt(struct path *path, int flags)
513+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) || defined(KSU_HAS_PATH_UMOUNT)
514+
static void ksu_path_umount(const char *mnt, struct path *path, int flags)
515515
{
516516
int err = path_umount(path, flags);
517-
if (err) {
518-
pr_info("umount %s failed: %d\n", path->dentry->d_iname, err);
519-
}
517+
pr_info("%s: path: %s code: %d\n", __func__, mnt, err);
520518
}
521519
#else
522520
static void ksu_sys_umount(const char *mnt, int flags)
@@ -555,8 +553,8 @@ static void try_umount(const char *mnt, bool check_mnt, int flags)
555553
return;
556554
}
557555

558-
#ifdef KSU_HAS_PATH_UMOUNT
559-
ksu_umount_mnt(&path, flags);
556+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) || defined(KSU_HAS_PATH_UMOUNT)
557+
ksu_path_umount(mnt, &path, flags);
560558
// dont call path_put here!!
561559
// path_umount releases ref for us
562560
#else

0 commit comments

Comments
 (0)