diff options
| author | Kyle Evans <kevans@FreeBSD.org> | 2026-06-19 04:03:30 +0000 |
|---|---|---|
| committer | Kyle Evans <kevans@FreeBSD.org> | 2026-06-19 04:03:30 +0000 |
| commit | 8a3d28375450946e4b0de239c9239df54c22d298 (patch) | |
| tree | 1172f3373c41190a40fd3adf235fd201c6a0a5de | |
| parent | 59bd4840df037a6898b4e9d917a530bce113f053 (diff) | |
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
| -rw-r--r-- | sys/kern/uipc_socket.c | 6 |
1 files 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); |
