You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "anchao (via GitHub)" <gi...@apache.org> on 2026/10/21 05:47:46 UTC

[PR] fs/mmap: drop file reference when ram map add fails [nuttx]

anchao opened a new pull request, #20860:
URL: https://github.com/apache/nuttx/pull/20860

   ## Summary                                                                
                                                                             
   Fix a file reference leak in the `rammap()` failure path.                 
                                                                             
   `rammap()` takes an extra reference on the backing file before adding the 
   mapping entry to the current memory map. If `mm_map_add()` fails, the     
   mapping entry is not installed and the code falls through to the allocated
   region cleanup path.                                                      
                                                                             
   The previous failure path freed the allocated mapping region but did not  
   release the extra file reference.                                         
                                                                             
   This change drops the file reference before cleaning up the mapping region
   when `mm_map_add()` fails.                                                
                                                                             
   ## Impact                                                                 
                                                                             
   - Prevents leaking the backing file reference when `mm_map_add()` fails.  
   - Keeps the successful mapping path unchanged.                            
   - Only affects the error path after `file_ref()` succeeds and             
     `mm_map_add()` fails.                                                   
                                                                             
   ## Testing                                                                
   
   sim/nsh2


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fs/mmap: drop file reference when ram map add fails [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #20860:
URL: https://github.com/apache/nuttx/pull/20860


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fs/mmap: drop file reference when ram map add fails [nuttx]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20860:
URL: https://github.com/apache/nuttx/pull/20860#issuecomment-6311807168

   <!-- membrowse-pr-comment -->
   ## <img src="https://membrowse.com/membrowse-logo.svg" height="24" align="top"> MemBrowse Memory Report &middot; [Explore what changed →](https://membrowse.com/public/apache/nuttx?commit_sha=cc248a6ef27ba2ffce4a8d61bb25b8eeffcc9ed4)
   
   
   *No memory changes detected for:*
   - [arduino-mega2560](https://membrowse.com/public/apache/nuttx/target/arduino-mega2560/compare?head=cc248a6ef27ba2ffce4a8d61bb25b8eeffcc9ed4&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
   - [esp32-devkitc](https://membrowse.com/public/apache/nuttx/target/esp32-devkitc/compare?head=cc248a6ef27ba2ffce4a8d61bb25b8eeffcc9ed4&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
   - [hifive1-revb](https://membrowse.com/public/apache/nuttx/target/hifive1-revb/compare?head=cc248a6ef27ba2ffce4a8d61bb25b8eeffcc9ed4&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
   - [mirtoo](https://membrowse.com/public/apache/nuttx/target/mirtoo/compare?head=cc248a6ef27ba2ffce4a8d61bb25b8eeffcc9ed4&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
   - [qemu-armv8a](https://membrowse.com/public/apache/nuttx/target/qemu-armv8a/compare?head=cc248a6ef27ba2ffce4a8d61bb25b8eeffcc9ed4&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
   - [qemu-intel64](https://membrowse.com/public/apache/nuttx/target/qemu-intel64/compare?head=cc248a6ef27ba2ffce4a8d61bb25b8eeffcc9ed4&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
   - [rx65n-rsk2mb](https://membrowse.com/public/apache/nuttx/target/rx65n-rsk2mb/compare?head=cc248a6ef27ba2ffce4a8d61bb25b8eeffcc9ed4&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
   - [s698pm-dkit](https://membrowse.com/public/apache/nuttx/target/s698pm-dkit/compare?head=cc248a6ef27ba2ffce4a8d61bb25b8eeffcc9ed4&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
   - [stm32-nucleo-f103rb](https://membrowse.com/public/apache/nuttx/target/stm32-nucleo-f103rb/compare?head=cc248a6ef27ba2ffce4a8d61bb25b8eeffcc9ed4&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
   
   ---
   <sub>Catch memory regressions in CI with [MemBrowse](https://membrowse.com). Free for open source.</sub>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org