Remove kernel lock from ifa_ifwithaddr() and ifa_ifwithdstaddr().
authormvs <mvs@openbsd.org>
Tue, 18 Apr 2023 22:01:23 +0000 (22:01 +0000)
committermvs <mvs@openbsd.org>
Tue, 18 Apr 2023 22:01:23 +0000 (22:01 +0000)
commit46d22571b80fc6c890dd15455ae598c909d518df
treecbb89a775c42dbe8eb4c0c362ff7df6e0b51f389
parenta6b8260995b7cce5f7c2b4922e0b7f1c61321c01
Remove kernel lock from ifa_ifwithaddr() and ifa_ifwithdstaddr().
Netlock protects `if_list', `ifa_list' and returned `ifa' dereference,
so put netlock assertion within.

Please note, rtable_setsource() doesn't destroy data pointed by
`ar_source'. This is the `ifa_addr' data belongs to `ifa' and exclusive
netlock is required to destroy it. So the kernel lock is not required
within rt_setsource(). Take netlock by rt_setsource() caller to make
`ifa' dereference safe.

Suggestions and ok by bluhm@
sys/dev/usb/if_umb.c
sys/net/if.c
sys/net/if_var.h
sys/net/rtsock.c