Andrew Geissler | b7d2861 | 2020-07-24 16:15:54 -0500 | [diff] [blame] | 1 | From 9e765068582aae3696520346a7500322ca6cc2de Mon Sep 17 00:00:00 2001 |
| 2 | From: Joan Bruguera <joanbrugueram@gmail.com> |
| 3 | Date: Sat, 13 Jun 2020 19:46:44 +0200 |
| 4 | Subject: [PATCH] Fix build for Linux 5.8-rc1 |
| 5 | |
| 6 | See also: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9740ca4e95b43b91a4a848694a20d01ba6818f7b |
| 7 | https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=da1c55f1b272f4bd54671d459b39ea7b54944ef9 |
| 8 | https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d8ed45c5dcd455fc5848d47f86883a1b872ac0d0 |
| 9 | |
| 10 | Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com> |
| 11 | |
| 12 | Upstream-Status: Backport [9e765068582aae3696520346a7500322ca6cc2de] |
| 13 | |
| 14 | Signed-off-by: He Zhe <zhe.he@windriver.com> |
| 15 | --- |
| 16 | zc.c | 8 ++++++++ |
| 17 | 1 file changed, 8 insertions(+) |
| 18 | |
| 19 | diff --git a/zc.c b/zc.c |
| 20 | index ae464ff..2c286bb 100644 |
| 21 | --- a/zc.c |
| 22 | +++ b/zc.c |
| 23 | @@ -58,7 +58,11 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write, |
| 24 | return 0; |
| 25 | } |
| 26 | |
| 27 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)) |
| 28 | down_read(&mm->mmap_sem); |
| 29 | +#else |
| 30 | + mmap_read_lock(mm); |
| 31 | +#endif |
| 32 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)) |
| 33 | ret = get_user_pages(task, mm, |
| 34 | (unsigned long)addr, pgcount, write, 0, pg, NULL); |
| 35 | @@ -74,7 +78,11 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write, |
| 36 | (unsigned long)addr, pgcount, write ? FOLL_WRITE : 0, |
| 37 | pg, NULL, NULL); |
| 38 | #endif |
| 39 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)) |
| 40 | up_read(&mm->mmap_sem); |
| 41 | +#else |
| 42 | + mmap_read_unlock(mm); |
| 43 | +#endif |
| 44 | if (ret != pgcount) |
| 45 | return -EINVAL; |
| 46 | |
| 47 | -- |
| 48 | 2.17.1 |
| 49 | |