Add send buffer locking to uipc_send(). Without this locking a race can
occur between a reader and a writer that results in a panic upon close, e.g., "panic: sbflush_locked: cc 4 || mb 0xffffff0052afa400 || mbcnt 0" Reviewed by: rwatson@ MFC after: 2 weeks
This commit is contained in:
parent
84a8a1332e
commit
7abe2ac214
@ -452,7 +452,9 @@ uipc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam,
|
||||
}
|
||||
}
|
||||
|
||||
SOCKBUF_LOCK(&so->so_snd);
|
||||
if (so->so_snd.sb_state & SBS_CANTSENDMORE) {
|
||||
SOCKBUF_UNLOCK(&so->so_snd);
|
||||
error = EPIPE;
|
||||
break;
|
||||
}
|
||||
@ -478,6 +480,7 @@ uipc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam,
|
||||
(so2->so_rcv.sb_cc - unp->unp_conn->unp_cc);
|
||||
(void)chgsbsize(so->so_cred->cr_uidinfo, &so->so_snd.sb_hiwat,
|
||||
newhiwat, RLIM_INFINITY);
|
||||
SOCKBUF_UNLOCK(&so->so_snd);
|
||||
unp->unp_conn->unp_cc = so2->so_rcv.sb_cc;
|
||||
sorwakeup_locked(so2);
|
||||
m = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user