Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Mar 2013 13:47:50 -0400
From:      Michael Tuexen <tuexen@fh-muenster.de>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r248172 - head/sys/kern
Message-ID:  <D2963C64-B2FF-4222-BB76-3D51D454C180@fh-muenster.de>
In-Reply-To: <201303111743.r2BHhuCj029280@svn.freebsd.org>
References:  <201303111743.r2BHhuCj029280@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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
>=20
> 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.
>=20
>  MFC after: 3 days
>=20
> Modified:
>  head/sys/kern/uipc_socket.c
>  head/sys/kern/uipc_syscalls.c
>=20
> Modified: head/sys/kern/uipc_socket.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- 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>
>=20
> #include <net/vnet.h>
>=20
> @@ -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 !=3D IPPROTO_SCTP) ||
> +	     (head->so_type !=3D SOCK_SEQPACKET))) {
> 		SOCK_LOCK(so);
> 		so->so_head =3D NULL;
> 		sofree(so);		/* NB: returns ACCEPT_UNLOCK'ed. =
*/
>=20
> Modified: head/sys/kern/uipc_syscalls.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- 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)
>=20
> 	CURVNET_SET(head->so_vnet);
> 	so =3D sonewconn(head, SS_ISCONNECTED);
> -	if (so =3D=3D NULL)
> +	if (so =3D=3D NULL) {
> +		error =3D ENOMEM;
> 		goto noconnection;
> +	}
> 	/*
> 	 * Before changing the flags on the socket, we have to bump the
> 	 * reference count.  Otherwise, if the protocol calls sofree(),
>=20




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D2963C64-B2FF-4222-BB76-3D51D454C180>