Index | Thread | Search

From:
Alexander Bluhm <bluhm@openbsd.org>
Subject:
Re: Don't re-lock sockets in uipc_shutdown()
To:
Vitaliy Makkoveev <mvs@openbsd.org>
Cc:
tech@openbsd.org
Date:
Thu, 2 May 2024 18:57:33 +0200

Download raw body.

Thread
On Sat, Apr 27, 2024 at 04:41:53PM +0300, Vitaliy Makkoveev wrote:
> No reason to lock peer. It can't be or became listening socket, both
> sockets can't be in the middle of connecting or disconnecting.

OK bluhm@

> Index: sys/kern/uipc_usrreq.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/uipc_usrreq.c,v
> retrieving revision 1.204
> diff -u -p -r1.204 uipc_usrreq.c
> --- sys/kern/uipc_usrreq.c	10 Apr 2024 12:04:41 -0000	1.204
> +++ sys/kern/uipc_usrreq.c	27 Apr 2024 13:26:47 -0000
> @@ -459,9 +459,9 @@ uipc_shutdown(struct socket *so)
>  
>  	socantsendmore(so);
>  
> -	if ((so2 = unp_solock_peer(unp->unp_socket))){
> +	if (unp->unp_conn != NULL) {
> +		so2 = unp->unp_conn->unp_socket;
>  		socantrcvmore(so2);
> -		sounlock(so2);
>  	}
>  
>  	return (0);