git: 8a3d28375450 - main - socket: remove tautological condition in so_unsplice()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 19 Jun 2026 04:05:14 UTC
The branch main has been updated by kevans:
URL: https://cgit.FreeBSD.org/src/commit/?id=8a3d28375450946e4b0de239c9239df54c22d298
commit 8a3d28375450946e4b0de239c9239df54c22d298
Author: Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2026-06-19 04:03:30 +0000
Commit: Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2026-06-19 04:03:30 +0000
socket: remove tautological condition in so_unsplice()
so2rele was introduced in 1000cc4a0d3 and it was necessary there, but
the cleanup in a837d1fe49e0255 rendered it redundant if our own KASSERT
is to be believed: we've asserted that `so2->so_splice_back == sp` and
`sp` has been dereferenced above, so there's no condition left where
we shouldn't release the socket reference at the end. Indeed, the
change in so_splice() to NULL out sp->dst removes that possible state of
a partially constructed splice: if sp->dst is set, it has been ref'd.
Reviewed by: gallatin, markj
Differential Revision: https://reviews.freebsd.org/D57558
---
sys/kern/uipc_socket.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index c7a7fdd44aa0..82a8ce8feb8c 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1805,7 +1805,7 @@ so_unsplice(struct socket *so, bool timeout)
{
struct socket *so2;
struct so_splice *sp;
- bool drain, so2rele;
+ bool drain;
/*
* First unset SB_SPLICED and hide the splice structure so that
@@ -1850,7 +1850,6 @@ so_unsplice(struct socket *so, bool timeout)
KASSERT(so2->so_splice_back == sp,
("%s: so_splice_back != sp", __func__));
so2->so_snd.sb_flags &= ~SB_SPLICED;
- so2rele = so2->so_splice_back != NULL;
so2->so_splice_back = NULL;
SOCK_SENDBUF_UNLOCK(so2);
SOCK_UNLOCK(so2);
@@ -1896,8 +1895,7 @@ so_unsplice(struct socket *so, bool timeout)
sorele(so);
if (so2 != NULL) {
sowwakeup(so2);
- if (so2rele)
- sorele(so2);
+ sorele(so2);
}
CURVNET_RESTORE();
so_splice_free(sp);