Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patches for kernel 5.19 #4

Merged
merged 2 commits into from
Sep 11, 2022
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion binder/binder.c
Original file line number Diff line number Diff line change
Expand Up @@ -2236,12 +2236,17 @@ static void binder_deferred_fd_close(int fd)
if (!twcb)
return;
init_task_work(&twcb->twork, binder_do_fd_close);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0))
twcb->file = close_fd_get_file(fd);
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
close_fd_get_file(fd, &twcb->file);
#else
__close_fd_get_file(fd, &twcb->file);
#endif
if (twcb->file) {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0))
get_file(twcb->file);
#endif
filp_close(twcb->file, current->files);
task_work_add(current, &twcb->twork, TWA_RESUME);
} else {
Expand Down
18 changes: 15 additions & 3 deletions binder/deps.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <linux/task_work.h>
#include <linux/sched.h>
#include <linux/file.h>
#include <linux/fdtable.h>
Expand Down Expand Up @@ -69,10 +70,16 @@ static unsigned long kallsyms_lookup_name_wrapper(const char *name)
#endif
}

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0))
static struct file *(*close_fd_get_file_ptr)(unsigned int fd)
#else
static int (*close_fd_get_file_ptr)(unsigned int fd, struct file **res)
#endif
= NULL;

static int (*close_fd_get_file_ptr)(unsigned int fd, struct file **res) = NULL;

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0))
struct file *close_fd_get_file(unsigned int fd)
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
int close_fd_get_file(unsigned int fd, struct file **res)
#else
int __close_fd_get_file(unsigned int fd, struct file **res)
Expand All @@ -84,7 +91,12 @@ int __close_fd_get_file(unsigned int fd, struct file **res)
#else
close_fd_get_file_ptr = kallsyms_lookup_name_wrapper("__close_fd_get_file");
#endif

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0))
return close_fd_get_file_ptr(fd);
#else
return close_fd_get_file_ptr(fd, res);
#endif
}

static int (*can_nice_ptr)(const struct task_struct *, const int) = NULL;
Expand Down