Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

binder: compilability with kernel 5.10 #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
12 changes: 12 additions & 0 deletions binder/binder.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,11 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
mm = get_task_mm(proc->tsk);

if (mm) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
mmap_write_lock(mm);
#else
down_write(&mm->mmap_sem);
#endif
vma = proc->vma;
if (vma && mm != proc->vma_vm_mm) {
pr_err("%d: vma mm and task mm mismatch\n",
Expand Down Expand Up @@ -680,7 +684,11 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
/* vm_insert_page does not seem to increment the refcount */
}
if (mm) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
mmap_write_unlock(mm);
#else
up_write(&mm->mmap_sem);
#endif
mmput(mm);
}
return 0;
Expand All @@ -707,7 +715,11 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
}
err_no_vma:
if (mm) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
mmap_write_unlock(mm);
#else
up_write(&mm->mmap_sem);
#endif
mmput(mm);
}
return -ENOMEM;
Expand Down