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

   ## Summary                                                              
                                                                           
   Fix the packet socket buffered send error path by allocating the send   
   callback before enqueueing the prepared IOB.                            
                                                                           
   `pkt_sendmsg()` previously queued the IOB into `conn->write_q` before   
   allocating the send callback. If callback allocation failed after that, 
   the error path still jumped to `errout_with_iob` and freed the IOB even 
   though ownership had already moved to the connection write queue.       
                                                                           
   This change allocates and validates the callback before enqueueing the  
   IOB. The IOB remains locally owned until all resources needed to notify 
   the driver are available.                                               
                                                                           
   ## Impact                                                               
                                                                           
   - Avoids freeing an IOB after it has already been queued.               
   - Prevents corrupting the packet socket write queue on callback         
     allocation failure.                                                   
   - Keeps the successful send path behavior unchanged.                    
   - Affects buffered packet socket send only.                             
                                                                           
   ## Testing                                                              
   
   sim/matter


-- 
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