aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/sctp_peeloff.c
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2012-03-15 14:13:38 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2012-03-15 14:13:38 +0000
commit99f293a20e2cda21db2843b2445717bc89a61fd2 (patch)
treeb2eab1fd923075a5f769b7a59ec7232beb0607b6 /sys/netinet/sctp_peeloff.c
parente06ea46468419fd37b6da2e39420c00fa52abf62 (diff)
downloadsrc-99f293a20e2cda21db2843b2445717bc89a61fd2.tar.gz
src-99f293a20e2cda21db2843b2445717bc89a61fd2.zip
Fix bugs which can result in a panic when an non-SCTP socket it
used with an sctp_ system-call which expects an SCTP socket. MFC after: 3 days.
Notes
Notes: svn path=/head/; revision=233004
Diffstat (limited to 'sys/netinet/sctp_peeloff.c')
-rw-r--r--sys/netinet/sctp_peeloff.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/netinet/sctp_peeloff.c b/sys/netinet/sctp_peeloff.c
index 425e3e9fcf63..87f586bc1ff3 100644
--- a/sys/netinet/sctp_peeloff.c
+++ b/sys/netinet/sctp_peeloff.c
@@ -59,16 +59,16 @@ sctp_can_peel_off(struct socket *head, sctp_assoc_t assoc_id)
SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EBADF);
return (EBADF);
}
- if ((head->so_proto->pr_protocol != IPPROTO_SCTP) ||
- (head->so_type != SOCK_SEQPACKET)) {
- SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EOPNOTSUPP);
- return (EOPNOTSUPP);
- }
inp = (struct sctp_inpcb *)head->so_pcb;
if (inp == NULL) {
SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EFAULT);
return (EFAULT);
}
+ if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
+ (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) {
+ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EOPNOTSUPP);
+ return (EOPNOTSUPP);
+ }
stcb = sctp_findassociation_ep_asocid(inp, assoc_id, 1);
if (stcb == NULL) {
SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_PEELOFF, ENOENT);