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

   ## Summary                                                                   
    
                                                                                
    
   Fix a memory leak in the virtio RNG read path when queue submission fails.   
    
                                                                                
    
   `virtio_rng_read()` allocates a DMA buffer before submitting it to the 
virtqueue.
   If `virtqueue_add_buffer()` failed, the function returned immediately 
without    
   freeing that buffer.                                                         
    
                                                                                
    
   This change frees the allocated buffer on the `virtqueue_add_buffer()` error 
    
   path, matching the existing cleanup used after a successful read completes.  
    
                                                                                
    
   ## Impact                                                                    
    
                                                                                
    
   This fixes a resource leak in the virtio RNG driver error path.              
    
                                                                                
    
   Expected impact:                                                             
    
                                                                                
    
   - frees the allocated DMA buffer when virtqueue submission fails             
    
   - preserves existing successful read behavior                                
    
   - does not change the device API or normal data path                         
    
   - no ABI, build-system, documentation, or security impact is expected        
    
                                                                                
    
   ## Testing                                                                   
    
   
   sim/nsh


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to