Patches for kernel 5.19

This commit is contained in:
TheSola10 2022-08-08 10:32:25 +02:00 committed by Christian Hoff
parent 2699623c48
commit 68444958fe
2 changed files with 17 additions and 4 deletions

View File

@ -2236,7 +2236,9 @@ static void binder_deferred_fd_close(int fd)
if (!twcb) if (!twcb)
return; return;
init_task_work(&twcb->twork, binder_do_fd_close); 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); close_fd_get_file(fd, &twcb->file);
#else #else
__close_fd_get_file(fd, &twcb->file); __close_fd_get_file(fd, &twcb->file);

View File

@ -1,3 +1,4 @@
#include <linux/task_work.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/file.h> #include <linux/file.h>
#include <linux/fdtable.h> #include <linux/fdtable.h>
@ -69,10 +70,15 @@ static unsigned long kallsyms_lookup_name_wrapper(const char *name)
#endif #endif
} }
static int (*close_fd_get_file_ptr)(unsigned int fd
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,19,0))
, 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,19,0))
struct file *close_fd_get_file(unsigned int fd)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0)) #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
int close_fd_get_file(unsigned int fd, struct file **res) int close_fd_get_file(unsigned int fd, struct file **res)
#else #else
int __close_fd_get_file(unsigned int fd, struct file **res) int __close_fd_get_file(unsigned int fd, struct file **res)
@ -84,7 +90,12 @@ int __close_fd_get_file(unsigned int fd, struct file **res)
#else #else
close_fd_get_file_ptr = kallsyms_lookup_name_wrapper("__close_fd_get_file"); close_fd_get_file_ptr = kallsyms_lookup_name_wrapper("__close_fd_get_file");
#endif #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); return close_fd_get_file_ptr(fd, res);
#endif
} }
static int (*can_nice_ptr)(const struct task_struct *, const int) = NULL; static int (*can_nice_ptr)(const struct task_struct *, const int) = NULL;