summaryrefslogtreecommitdiffstats
path: root/driver/umem.c
diff options
context:
space:
mode:
authorTimo Dritschler <timo.dritschler@kit.edu>2021-03-02 14:49:15 +0100
committerTimo Dritschler <timo.dritschler@kit.edu>2021-03-02 14:49:15 +0100
commit9b31f02596f197b6e215a48ad8b0b3286ab0be25 (patch)
treedc88e586c27b4e2811bc1fdde6bacb34f94107b4 /driver/umem.c
parenta2ff777765656324ca43ae7265f34d5b0b2e3b3a (diff)
downloadpcitool-9b31f02596f197b6e215a48ad8b0b3286ab0be25.tar.gz
pcitool-9b31f02596f197b6e215a48ad8b0b3286ab0be25.tar.bz2
pcitool-9b31f02596f197b6e215a48ad8b0b3286ab0be25.tar.xz
pcitool-9b31f02596f197b6e215a48ad8b0b3286ab0be25.zip
Added patch for Kernel 5.8.0+
mmap_sem renamed to mmap_lock https://github.com/torvalds/linux/commit/da1c55f1b272f4bd54671d459b39ea7b54944ef9
Diffstat (limited to 'driver/umem.c')
-rw-r--r--driver/umem.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/driver/umem.c b/driver/umem.c
index e643102..070da46 100644
--- a/driver/umem.c
+++ b/driver/umem.c
@@ -80,9 +80,20 @@ int pcidriver_umem_sgmap(pcidriver_privdata_t *privdata, umem_handle_t *umem_han
mod_info_dbg("allocated space for the SG list.\n");
/* Get the page information */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)
+ /*As of Kernel 5.8.0, the mmap_sem member of the MM struct has been
+ * renamed to mmap_lock
+ * See:
+ * https://github.com/torvalds/linux/commit/da1c55f1b272f4bd54671d459b39ea7b54944ef9
+ */
+ down_read(&current->mm->mmap_lock);
+ res = get_user_pages_compat(umem_handle->vma, nr_pages, pages);
+ up_read(&current->mm->mmap_lock);
+#else
down_read(&current->mm->mmap_sem);
res = get_user_pages_compat(umem_handle->vma, nr_pages, pages);
up_read(&current->mm->mmap_sem);
+#endif
/* Error, not all pages mapped */
if (res < (int)nr_pages) {