aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-kernel/cryptodev/sdk_patches/0094-Adjust-to-another-change-in-the-user-page-API.patch
blob: 9483d0c642e3ef92193149624d8104237d1ab4a8 (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
29
30
31
32
33
34
35
36
From b7783948df06674da12352ff4f55c6e7c4213026 Mon Sep 17 00:00:00 2001
From: Michael Weiser <michael.weiser@gmx.de>
Date: Fri, 11 Nov 2016 18:09:32 +0100
Subject: [PATCH 094/104] Adjust to another change in the user page API

4.9.0 will replace the write and force flags of get_user_pages_remote()
with a gup_flags parameter[1]. Distinguish the two APIs based on kernel
version we're compiling for.

[1] https://github.com/torvalds/linux/commit/9beae1ea89305a9667ceaab6d0bf46a045ad71e7
---
 zc.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/zc.c b/zc.c
index a97b49f..e766ee3 100644
--- a/zc.c
+++ b/zc.c
@@ -65,7 +65,13 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write,
 	ret = get_user_pages(
 #endif
 			task, mm,
-			(unsigned long)addr, pgcount, write, 0, pg, NULL);
+			(unsigned long)addr, pgcount,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))
+			write ? FOLL_WRITE : 0,
+#else
+			write, 0,
+#endif
+			pg, NULL);
 	up_read(&mm->mmap_sem);
 	if (ret != pgcount)
 		return -EINVAL;
-- 
2.10.2