inpcb: Reorder kmalloc and inp checking in set{peer,sock}addr().
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 19 Oct 2015 13:36:27 +0000 (21:36 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 20 Oct 2015 07:19:53 +0000 (15:19 +0800)
commitb15c47143c7c434b60c41e71eec5022043fb92b7
treeb21fb416956cd510f1ee62d21caa58a48fa92306
parent2f3cc6c987caf6a8fe203d4436146000aea5e38b
inpcb: Reorder kmalloc and inp checking in set{peer,sock}addr().

Since kmalloc(M_WAITOK) happens in the owner protocol thread of
inp, we don't care about possible kmalloc block.  This makes the
code more straightforward.

While I'm here:
- Staticize {in,in6}_setsockaddr().
- Remove unnecessary critical sections.
- Fix staled comment about NULL PCB for set{peer,sock}addr().
sys/netinet/in_pcb.c
sys/netinet/in_pcb.h
sys/netinet6/in6_pcb.c
sys/netinet6/in6_pcb.h