On Mar 11, 2013, at 1:43 PM, Michael Tuexen wrote: > Author: tuexen > Date: Mon Mar 11 17:43:55 2013 > New Revision: 248172 > URL: http://svnweb.freebsd.org/changeset/base/248172 > > Log: > Return an error if sctp_peeloff() fails because a socket can't be allocated. Hmm. Just wanted to commit the change to uipc_syscalls.c and do the other fix separately. So the missing commit message is: sctp_peeloff() uses sonewconn() also in cases where listen() wasn't called. So honor this use case. > > MFC after: 3 days > > Modified: > head/sys/kern/uipc_socket.c > head/sys/kern/uipc_syscalls.c > > Modified: head/sys/kern/uipc_socket.c > ============================================================================== > --- head/sys/kern/uipc_socket.c Mon Mar 11 17:36:37 2013 > (r248171) > +++ head/sys/kern/uipc_socket.c Mon Mar 11 17:43:55 2013 > (r248172) > @@ -136,6 +136,7 @@ __FBSDID("$FreeBSD$"); > #include <sys/uio.h> > #include <sys/jail.h> > #include <sys/syslog.h> > +#include <netinet/in.h> > > #include <net/vnet.h> > > @@ -565,8 +566,12 @@ sonewconn(struct socket *head, int conns > /* > * The accept socket may be tearing down but we just > * won a race on the ACCEPT_LOCK. > + * However, if sctp_peeloff() is called on a 1-to-many > + * style socket, the SO_ACCEPTCONN doesn't need to be set. > */ > - if (!(head->so_options & SO_ACCEPTCONN)) { > + if (!(head->so_options & SO_ACCEPTCONN) && > + ((head->so_proto->pr_protocol != IPPROTO_SCTP) || > + (head->so_type != SOCK_SEQPACKET))) { > SOCK_LOCK(so); > so->so_head = NULL; > sofree(so); /* NB: returns ACCEPT_UNLOCK'ed. */ > > Modified: head/sys/kern/uipc_syscalls.c > ============================================================================== > --- head/sys/kern/uipc_syscalls.c Mon Mar 11 17:36:37 2013 > (r248171) > +++ head/sys/kern/uipc_syscalls.c Mon Mar 11 17:43:55 2013 > (r248172) > @@ -2386,8 +2386,10 @@ sys_sctp_peeloff(td, uap) > > CURVNET_SET(head->so_vnet); > so = sonewconn(head, SS_ISCONNECTED); > - if (so == NULL) > + if (so == NULL) { > + error = ENOMEM; > goto noconnection; > + } > /* > * Before changing the flags on the socket, we have to bump the > * reference count. Otherwise, if the protocol calls sofree(), >
_______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"