This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch releases/12.3
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 92baeea676ba096a51b9042979ef6aa703eefd81
Author: Ville Juven <ville.ju...@unikie.com>
AuthorDate: Tue Oct 3 12:53:32 2023 +0300

    kmm_map.c: Fix user page mapping
    
    User pages are mapped from the currently active address environment. If
    the process is running on a borrowed address environment, then the
    mapping should be created from there.
    
    This happens during (new) process creation only.
---
 mm/kmap/kmm_map.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/kmap/kmm_map.c b/mm/kmap/kmm_map.c
index d6d1c6c9fa..4358ae57a6 100644
--- a/mm/kmap/kmm_map.c
+++ b/mm/kmap/kmm_map.c
@@ -82,7 +82,7 @@ static int get_user_pages(FAR void **pages, size_t npages, 
uintptr_t vaddr)
 
   for (i = 0; i < npages; i++, vaddr += MM_PGSIZE)
     {
-      page = up_addrenv_find_page(&tcb->addrenv_own->addrenv, vaddr);
+      page = up_addrenv_find_page(&tcb->addrenv_curr->addrenv, vaddr);
       if (!page)
         {
           /* Something went wrong, get out */
@@ -182,7 +182,7 @@ static FAR void *map_single_user_page(uintptr_t vaddr)
 
   /* Find the page associated with this virtual address */
 
-  page = up_addrenv_find_page(&tcb->addrenv_own->addrenv, vaddr);
+  page = up_addrenv_find_page(&tcb->addrenv_curr->addrenv, vaddr);
   if (!page)
     {
       return NULL;

Reply via email to