svn commit: r360113 - stable/12/sys/kern
Mark Johnston
markj at FreeBSD.org
Mon Apr 20 13:18:36 UTC 2020
Author: markj
Date: Mon Apr 20 13:18:36 2020
New Revision: 360113
URL: https://svnweb.freebsd.org/changeset/base/360113
Log:
MFC r359893:
Fix sendto() on unconnected SOCK_STREAM/SEQPACKET unix sockets.
Modified:
stable/12/sys/kern/uipc_usrreq.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/kern/uipc_usrreq.c
==============================================================================
--- stable/12/sys/kern/uipc_usrreq.c Mon Apr 20 08:15:36 2020 (r360112)
+++ stable/12/sys/kern/uipc_usrreq.c Mon Apr 20 13:18:36 2020 (r360113)
@@ -1135,25 +1135,29 @@ uipc_send(struct socket *so, int flags, struct mbuf *m
case SOCK_STREAM:
if ((so->so_state & SS_ISCONNECTED) == 0) {
if (nam != NULL) {
- if ((error = connect_internal(so, nam, td)))
+ error = connect_internal(so, nam, td);
+ if (error != 0)
break;
- } else {
+ } else {
error = ENOTCONN;
break;
}
- } else if ((unp2 = unp->unp_conn) == NULL) {
+ } else {
+ UNP_PCB_LOCK(unp);
+ }
+
+ if ((unp2 = unp->unp_conn) == NULL) {
+ UNP_PCB_UNLOCK(unp);
error = ENOTCONN;
break;
} else if (so->so_snd.sb_state & SBS_CANTSENDMORE) {
+ UNP_PCB_UNLOCK(unp);
error = EPIPE;
break;
- } else {
- UNP_PCB_LOCK(unp);
- if ((unp2 = unp->unp_conn) == NULL) {
- UNP_PCB_UNLOCK(unp);
- error = ENOTCONN;
- break;
- }
+ } else if ((unp2 = unp->unp_conn) == NULL) {
+ UNP_PCB_UNLOCK(unp);
+ error = ENOTCONN;
+ break;
}
unp_pcb_owned_lock2(unp, unp2, freed);
UNP_PCB_UNLOCK(unp);
@@ -1195,15 +1199,11 @@ uipc_send(struct socket *so, int flags, struct mbuf *m
sbappend_locked(&so2->so_rcv, m, flags);
break;
- case SOCK_SEQPACKET: {
- const struct sockaddr *from;
-
- from = &sun_noname;
+ case SOCK_SEQPACKET:
if (sbappendaddr_nospacecheck_locked(&so2->so_rcv,
- from, m, control))
+ &sun_noname, m, control))
control = NULL;
break;
- }
}
mbcnt = so2->so_rcv.sb_mbcnt;
More information about the svn-src-stable
mailing list