From: Alexander Bluhm Subject: Re: Unlock udp(4) somove() To: Vitaliy Makkoveev Cc: tech@openbsd.org Date: Sat, 20 Jul 2024 18:49:51 +0200 On Sat, Jul 20, 2024 at 06:35:23PM +0300, Vitaliy Makkoveev wrote: > mtx_leave(&sosp->so_snd.sb_mtx); > + mtx_leave(&so->so_rcv.sb_mtx); > > + if (sockdgram) > + solock_shared(sosp); > error = pru_send(sosp, m, NULL, NULL); > + if (sockdgram) > + sounlock_shared(sosp); > + > + mtx_enter(&so->so_rcv.sb_mtx); > + mtx_enter(&sosp->so_snd.sb_mtx); > + > if (error) { > - if (sosp->so_snd.sb_state & SS_CANTSENDMORE) > + if (sosp->so_snd.sb_state & SS_CANTSENDMORE || > + so->so_pcb == NULL) > error = EPIPE; > goto release; > } In a previous diff the check was sosp->so_pcb == NULL. As the error comes from pru_send(sosp) we should check whether sosp still has a pcb. bluhm