sctp: fix so_proto when peeling off a socket

Reported by:		glebius
Reviewed by:		rrs
Fixes:			d195b3783f ("sctp: fix socket type created by sctp_peeloff()")
Differential Revision:	https://reviews.freebsd.org/D55454
This commit is contained in:
Michael Tuexen committed 2026-02-25 13:55:54 +01:00
1 parent bce0c14fe1
commit 454212b971
3 files changed
+6 -4

No files matched your search

+2 -2
View File
@@ -1316,7 +1316,7 @@ solisten_enqueue(struct socket *so, int connstatus)
* XXXGL: reduce copy-paste with solisten_clone().
*/
struct socket *
sopeeloff(struct socket *head)
sopeeloff(struct socket *head, struct protosw *so_proto)
{
struct socket *so;
@@ -1336,7 +1336,7 @@ sopeeloff(struct socket *head)
so->so_linger = head->so_linger;
so->so_state = (head->so_state & SS_NBIO) | SS_ISCONNECTED;
so->so_fibnum = head->so_fibnum;
so->so_proto = head->so_proto;
so->so_proto = so_proto;
so->so_cred = crhold(head->so_cred);
#ifdef MAC
mac_socket_newconn(head, so);
+3 -1
View File
@@ -75,6 +75,8 @@
#include <security/mac/mac_framework.h>
#include <netinet/sctp.h>
#include <netinet/sctp_pcb.h>
#include <netinet/sctp_var.h>
#include <netinet/sctp_os_bsd.h>
#include <netinet/sctp_peeloff.h>
@@ -171,7 +173,7 @@ sys_sctp_peeloff(struct thread *td, struct sctp_peeloff_args *uap)
td->td_retval[0] = fd;
CURVNET_SET(head->so_vnet);
so = sopeeloff(head);
so = sopeeloff(head, &sctp_stream_protosw);
if (so == NULL) {
error = ENOMEM;
goto noconnection;
+1 -1
View File
@@ -525,7 +525,7 @@ struct socket *
struct socket *
sonewconn(struct socket *head, int connstatus);
struct socket *
sopeeloff(struct socket *);
sopeeloff(struct socket *, struct protosw *);
int sopoll_generic(struct socket *so, int events, struct thread *td);
int sokqfilter_generic(struct socket *so, struct knote *kn);
int soaio_queue_generic(struct socket *so, struct kaiocb *job);