The branch stable/15 has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=c8cc4427040443512411090b4bc75459c13b1ae6

commit c8cc4427040443512411090b4bc75459c13b1ae6
Author:     Mark Johnston <[email protected]>
AuthorDate: 2026-07-01 15:35:10 +0000
Commit:     Mark Johnston <[email protected]>
CommitDate: 2026-07-08 18:09:35 +0000

    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
    
    (cherry picked from commit 2a4b8fd1dc070e71fbaab6f12c1c9e4452652aa7)
---
 sys/kern/uipc_usrreq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 87d7aa411b4d..bbea5ef3914c 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -2430,8 +2430,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))

Reply via email to