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

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 1ba84c29fcdd2a57f714dad0eba6d8d8dbae6af5
Author: zhangbo56 <[email protected]>
AuthorDate: Wed Feb 26 19:33:08 2025 +0800

    mm: Pass group to unmap when calling mm_destroy_map
    
    When group_leave, the tcb->group has been set to NULL before calling
    mm_destroy_map, so pass the group and driver could get task mm.
    
    Signed-off-by: zhangbo56 <[email protected]>
---
 mm/map/mm_map.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mm/map/mm_map.c b/mm/map/mm_map.c
index c266dd99257..e8ee3449a29 100644
--- a/mm/map/mm_map.c
+++ b/mm/map/mm_map.c
@@ -24,6 +24,7 @@
  * Included Files
  ****************************************************************************/
 
+#include <nuttx/nuttx.h>
 #include <nuttx/mm/map.h>
 #include <nuttx/pgalloc.h>
 #include <nuttx/addrenv.h>
@@ -145,6 +146,8 @@ void mm_map_initialize(FAR struct mm_map_s *mm, bool kernel)
 void mm_map_destroy(FAR struct mm_map_s *mm)
 {
   FAR struct mm_map_entry_s *entry;
+  FAR struct task_group_s *group = container_of(
+                                       mm, struct task_group_s, tg_mm_map);
 
   while ((entry = (FAR struct mm_map_entry_s *)sq_remfirst(&mm->mm_map_sq)))
     {
@@ -158,7 +161,7 @@ void mm_map_destroy(FAR struct mm_map_s *mm)
 
       if (entry->munmap)
         {
-          if (entry->munmap(NULL, entry, entry->vaddr, entry->length) < 0)
+          if (entry->munmap(group, entry, entry->vaddr, entry->length) < 0)
             {
               /* This would be an error in the driver. It has defined munmap,
                * but is not able to munmap the full area which it has mapped

Reply via email to