Fix a bug reported by Peter Holm which results in a crash:

Verify in sctp_peeloff() that the socket is a one-to-many
style SCTP socket.

MFC after: 3 days.
This commit is contained in:
Michael Tuexen 2012-03-09 13:12:33 +00:00
parent 0502467707
commit 425d06a13d

View File

@ -55,6 +55,15 @@ sctp_can_peel_off(struct socket *head, sctp_assoc_t assoc_id)
struct sctp_tcb *stcb;
uint32_t state;
if (head == NULL) {
SCTP_LTRACE_ERR_RET(inp, 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(inp, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EOPNOTSUPP);
return (EOPNOTSUPP);
}
inp = (struct sctp_inpcb *)head->so_pcb;
if (inp == NULL) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EFAULT);