aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2026-07-01 15:35:10 +0000
committerMark Johnston <markj@FreeBSD.org>2026-07-01 15:35:16 +0000
commit2a4b8fd1dc070e71fbaab6f12c1c9e4452652aa7 (patch)
tree4927a962de1ae6f117fc9efbad22db6f7763668d
parent524fb0444f3ad0f52b6f706267181564e33f9771 (diff)
unix: Fix a socket refcount leak in uipc_sendfile_wait()
Fixes: d15792780760 ("unix: new implementation of unix/stream & unix/seqpacket") Reviewed by: glebius MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D57967
-rw-r--r--sys/kern/uipc_usrreq.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index ad6d546afa25..0b4e49c7db55 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -2446,8 +2446,10 @@ uipc_sendfile_wait(struct socket *so, off_t need, int *space)
SOCK_RECVBUF_UNLOCK(so2);
return (EAGAIN);
}
- if (!sockref)
+ if (!sockref) {
soref(so2);
+ sockref = true;
+ }
error = uipc_stream_sbwait(so2, so->so_snd.sb_timeo);
if (error == 0 &&
__predict_false(sb->sb_state & SBS_CANTRCVMORE))