wengzhe commented on PR #12419:
URL: https://github.com/apache/nuttx/pull/12419#issuecomment-2137733667

   > > @acassis as far as I can tell, the calls to net_unlock() in lines 845 
and 893 are not preceded by a call to net_lock().
   > > I just mirrored the logic from tcp_ipv4_bind(). Maybe someone with 
knowledge about the network stack can chip in a better solution?
   > 
   > @wengzhe could you take a look?
   
   Yes, I found the PR 
https://github.com/apache/nuttx/pull/10038/files#diff-e791b12e7112fb69dc700af71b6d8ed95f02b9cc717a3b460e2425d734e60593R846
 has added unpaired `net_unlock`, maybe @wangchen61698 was copying from what 
he'd written in `tcp_ipv*_bind`, which has locked at the beginning of the 
function.
   
   Then back to the current PR, extending the scope of the lock may not harm 
performance that much:
   - The for loop of net devices is the code we want to protect
   - Other codes are already locked (notice that `udp_select_port` takes the 
lock inside.)
   So this change is acceptable to me.


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