sync with OpenBSD -current

This commit is contained in:
purplerain 2024-06-29 09:21:17 +00:00
parent caabca1cee
commit aaa686b79e
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
15 changed files with 537 additions and 267 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uipc_socket2.c,v 1.155 2024/05/17 19:11:14 mvs Exp $ */
/* $OpenBSD: uipc_socket2.c,v 1.156 2024/06/28 21:30:24 mvs Exp $ */
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
/*
@ -160,8 +160,6 @@ void
soisdisconnected(struct socket *so)
{
soassertlocked(so);
so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING);
so->so_state |= SS_ISDISCONNECTED;
mtx_enter(&so->so_rcv.sb_mtx);
so->so_rcv.sb_state |= SS_CANTRCVMORE;
@ -171,6 +169,9 @@ soisdisconnected(struct socket *so)
so->so_snd.sb_state |= SS_CANTSENDMORE;
mtx_leave(&so->so_snd.sb_mtx);
so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING);
so->so_state |= SS_ISDISCONNECTED;
wakeup(&so->so_timeo);
sowwakeup(so);
sorwakeup(so);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uipc_usrreq.c,v 1.207 2024/06/26 12:23:36 mvs Exp $ */
/* $OpenBSD: uipc_usrreq.c,v 1.208 2024/06/28 21:30:24 mvs Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
@ -513,6 +513,14 @@ uipc_send(struct socket *so, struct mbuf *m, struct mbuf *nam,
goto out;
}
/*
* We hold both solock() and `sb_mtx' mutex while modifying
* SS_CANTSENDMORE flag. solock() is enough to check it.
*/
if (so->so_snd.sb_state & SS_CANTSENDMORE) {
error = EPIPE;
goto dispose;
}
if (unp->unp_conn == NULL) {
error = ENOTCONN;
goto dispose;
@ -531,12 +539,6 @@ uipc_send(struct socket *so, struct mbuf *m, struct mbuf *nam,
*/
mtx_enter(&so2->so_rcv.sb_mtx);
mtx_enter(&so->so_snd.sb_mtx);
if (so->so_snd.sb_state & SS_CANTSENDMORE) {
mtx_leave(&so->so_snd.sb_mtx);
mtx_leave(&so2->so_rcv.sb_mtx);
error = EPIPE;
goto dispose;
}
if (control) {
if (sbappendcontrol(so2, &so2->so_rcv, m, control)) {
control = NULL;