Module: xenomai-3
Branch: next
Commit: 30b2cbb28c3b184d883ad7642107b86878bd6635
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=30b2cbb28c3b184d883ad7642107b86878bd6635

Author: Philippe Gerum <r...@xenomai.org>
Date:   Fri Apr 28 12:14:41 2017 +0200

cobalt/rtdm: fix regression in memory mapping request

e6ce133 should have only fixed a spurious __user annotation instead of
introducing a wrong copy to user. Do the right thing now.

---

 include/cobalt/kernel/rtdm/fd.h |    2 +-
 kernel/cobalt/rtdm/fd.c         |    8 ++------
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/include/cobalt/kernel/rtdm/fd.h b/include/cobalt/kernel/rtdm/fd.h
index dc653d6..086b04b 100644
--- a/include/cobalt/kernel/rtdm/fd.h
+++ b/include/cobalt/kernel/rtdm/fd.h
@@ -369,7 +369,7 @@ ssize_t rtdm_fd_sendmsg(int ufd, const struct user_msghdr 
*msg,
                        int flags);
 
 int rtdm_fd_mmap(int ufd, struct _rtdm_mmap_request *rma,
-                void * __user *u_addrp);
+                void **u_addrp);
 
 int rtdm_fd_valid_p(int ufd);
 
diff --git a/kernel/cobalt/rtdm/fd.c b/kernel/cobalt/rtdm/fd.c
index 4b788c5..ffcd3aa 100644
--- a/kernel/cobalt/rtdm/fd.c
+++ b/kernel/cobalt/rtdm/fd.c
@@ -656,10 +656,9 @@ ebadf:
 EXPORT_SYMBOL_GPL(rtdm_fd_close);
 
 int rtdm_fd_mmap(int ufd, struct _rtdm_mmap_request *rma,
-                void * __user *u_addrp)
+                void **u_addrp)
 {
        struct rtdm_fd *fd;
-       void *addr;
        int ret;
 
        secondary_mode_only();
@@ -680,10 +679,7 @@ int rtdm_fd_mmap(int ufd, struct _rtdm_mmap_request *rma,
        }
 
        ret = __rtdm_mmap_from_fdop(fd, rma->length, rma->offset,
-                                   rma->prot, rma->flags, &addr);
-       if (ret == 0)
-               ret = rtdm_safe_copy_to_user(fd, u_addrp,
-                                            &addr,  sizeof(addr));
+                                   rma->prot, rma->flags, u_addrp);
 unlock:
        rtdm_fd_put(fd);
 out:


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to