git: 70cfba4a0462 - stable/14 - sctp: fix socket type created by sctp_peeloff()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 26 Apr 2026 08:24:20 UTC
The branch stable/14 has been updated by tuexen:
URL: https://cgit.FreeBSD.org/src/commit/?id=70cfba4a0462df22ef48b84870e4b4e54079c1ea
commit 70cfba4a0462df22ef48b84870e4b4e54079c1ea
Author: Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2026-01-31 18:11:08 +0000
Commit: Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2026-04-26 06:22:42 +0000
sctp: fix socket type created by sctp_peeloff()
When calling sctp_peeloff() on a SOCK_SEQPACKET socket, the created
and returned socket has the type SOCK_STREAM.
This is specified in section 9.2 of RFC 6458.
Reported by: Xin Long
Event: Wiesbaden Hackathon 2026
(cherry picked from commit d195b3783fa4de5c1a95f6d95eb9444abce6778b)
---
sys/kern/uipc_socket.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 4687d29b33b1..4fca51a853a3 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1280,7 +1280,7 @@ solisten_enqueue(struct socket *so, int connstatus)
#if defined(SCTP) || defined(SCTP_SUPPORT)
/*
- * Socket part of sctp_peeloff(). Detach a new socket from an
+ * Socket part of sctp_peeloff(). Create a new socket for an
* association. The new socket is returned with a reference.
*
* XXXGL: reduce copy-paste with solisten_clone().
@@ -1292,6 +1292,8 @@ sopeeloff(struct socket *head)
VNET_ASSERT(head->so_vnet != NULL, ("%s:%d so_vnet is NULL, head=%p",
__func__, __LINE__, head));
+ KASSERT(head->so_type == SOCK_SEQPACKET,
+ ("%s: unexpecte so_type: %d", __func__, head->so_type));
so = soalloc(head->so_vnet);
if (so == NULL) {
log(LOG_DEBUG, "%s: pcb %p: New socket allocation failure: "
@@ -1299,7 +1301,7 @@ sopeeloff(struct socket *head)
__func__, head->so_pcb);
return (NULL);
}
- so->so_type = head->so_type;
+ so->so_type = SOCK_STREAM;
so->so_options = head->so_options;
so->so_linger = head->so_linger;
so->so_state = (head->so_state & SS_NBIO) | SS_ISCONNECTED;