summarylogtreecommitdiffstats
path: root/fix-mmap-lock.patch
blob: 3c1780da47da1bf2f63988cb7bc3ae155fba4499 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
diff --git a/blackmagic-11.6a26/blackmagic_lib.c b/blackmagic-11.6a26/blackmagic_lib.c
index 83fab89..95f7c44 100644
--- a/blackmagic-11.6a26/blackmagic_lib.c
+++ b/blackmagic-11.6a26/blackmagic_lib.c
@@ -671,7 +671,11 @@ dl_get_user_pages(void *task_ptr, void *ptr, unsigned long size, unsigned long *
 	else
 		write = 0;
 	
+#if KERNEL_VERSION_OR_LATER(5, 8, 0)
+    down_read(&current_task->mm->mmap_lock);
+#else
 	down_read(&current_task->mm->mmap_sem);
+#endif
 #if KERNEL_VERSION_OR_LATER(4, 10, 0)
 		if (current_task == current)
 			ret = get_user_pages((unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages, NULL);
@@ -692,7 +696,11 @@ dl_get_user_pages(void *task_ptr, void *ptr, unsigned long size, unsigned long *
 #else
 		ret = get_user_pages(current_task, current_task->mm, (unsigned long)ptr & PAGE_MASK, *nr_pages, write, 0, pages, NULL);
 #endif
+#if KERNEL_VERSION_OR_LATER(5, 8, 0)
+    up_read(&current_task->mm->mmap_lock);
+#else
 	up_read(&current_task->mm->mmap_sem);
+#endif
 	
 	if (ret < (long)*nr_pages)
 	{