More check in rtdm mmap, also use kernel memory instead of virtual memory.
--- a/master/rtdm.c Thu Sep 27 00:21:27 2018 +0200
+++ b/master/rtdm.c Thu Sep 27 17:56:16 2018 +0200
@@ -216,8 +216,12 @@
*/
int ec_rtdm_mmap(struct rtdm_fd *fd, struct vm_area_struct *vma)
{
- ec_ioctl_context_t *ctx = (ec_ioctl_context_t *) rtdm_fd_to_private(fd);
- return rtdm_mmap_vmem(vma, (void *)ctx->process_data);
-}
-
-/****************************************************************************/
+ size_t len;
+ ec_ioctl_context_t *ctx = (ec_ioctl_context_t *) rtdm_fd_to_private(fd);
+ len = vma->vm_end - vma->vm_start;
+ if (ctx->process_data_size != len)
+ return -EINVAL;
+ return rtdm_mmap_kmem(vma, (void *)ctx->process_data);
+}
+
+/****************************************************************************/