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 0f9a2a144f718b9974eaa79f7c88999f075c3732 Author: jingfei <[email protected]> AuthorDate: Tue Nov 24 13:48:59 2026 +0800 fs/shm: finish munmap() bookkeeping when the process exits mm_map_destroy() unmaps every region with a NULL group when a process exits. In the kernel build shmfs_unmap_area() returned -EINVAL for a NULL group, so shmfs_munmap() skipped the rest of the teardown: the inode reference taken by mmap() leaked and an unlinked object was never freed. Skip only the MMU unmap for a NULL group, as shmdt() does, and finish the bookkeeping. Signed-off-by: jingfei <[email protected]> --- fs/shm/shmfs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/shm/shmfs.c b/fs/shm/shmfs.c index 81a6a7c0dde..9c0dc92f72a 100644 --- a/fs/shm/shmfs.c +++ b/fs/shm/shmfs.c @@ -496,7 +496,9 @@ static int shmfs_unmap_area(FAR struct task_group_s *group, #ifdef CONFIG_BUILD_KERNEL unsigned int npages; - /* Convert the region size to pages */ + /* A NULL group means the process is exiting and its MMU mappings must + * not be touched; only the bookkeeping is left, as in shmdt(). + */ if (group) { @@ -514,10 +516,6 @@ static int shmfs_unmap_area(FAR struct task_group_s *group, vm_release_region(get_group_mm(group), vaddr, length); } - else - { - return -EINVAL; - } #endif return ret;
