Fixed page fault by matching in-tree binder behavior

This commit is contained in:
TheSola10 2022-08-09 17:39:31 +02:00 committed by Christian Hoff
parent 68444958fe
commit 2325d6fe45
2 changed files with 8 additions and 4 deletions

View File

@ -2244,6 +2244,9 @@ static void binder_deferred_fd_close(int fd)
__close_fd_get_file(fd, &twcb->file); __close_fd_get_file(fd, &twcb->file);
#endif #endif
if (twcb->file) { if (twcb->file) {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0))
get_file(twcb->file);
#endif
filp_close(twcb->file, current->files); filp_close(twcb->file, current->files);
task_work_add(current, &twcb->twork, TWA_RESUME); task_work_add(current, &twcb->twork, TWA_RESUME);
} else { } else {

View File

@ -70,11 +70,12 @@ 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))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,19,0)) static struct file *(*close_fd_get_file_ptr)(unsigned int fd)
, struct file **res #else
static int (*close_fd_get_file_ptr)(unsigned int fd, struct file **res)
#endif #endif
) = NULL; = NULL;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0))
struct file *close_fd_get_file(unsigned int fd) struct file *close_fd_get_file(unsigned int fd)