Index | Thread | Search

From:
Vitaliy Makkoveev <mvs@openbsd.org>
Subject:
Re: Unlock udp(4) somove()
To:
Alexander Bluhm <bluhm@openbsd.org>
Cc:
tech@openbsd.org
Date:
Sat, 20 Jul 2024 19:56:51 +0300

Download raw body.

Thread
Thank for catching.

> On 20 Jul 2024, at 19:49, Alexander Bluhm <bluhm@openbsd.org> wrote:
> 
> 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
>