A few bugfixes
Summary
Please let me know if you need the commits in separate pull requests (I'm new at this).
udp_bind: there was an unmatch net_unlock()
tcp: fix non-compliant return value on error
stm32*: fix macro addresses (that doesn't seem to have been used)
Impact
Testing
It works for me.
@wangchen61698 please take a look!
@kk-thrane about you comment "net_unlock() called without a previous call to net_lock()." looking the code it doesn't appear to be the case, net_lock() and net_unlock() seems to be called correctly inside the else block.
Also I think your modification will keep the net blocked for more time.
@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?
@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?
@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_porttakes the lock inside.)
So this change is acceptable to me.
Please advice if i need to do something to get these patches approved
Please advice if i need to do something to get these patches approved
I think it is fine. wengzhe already confirmed the unbalanced lock/unlock. I'll merge it now, sorry for missing that!