Date: Sat, 17 Apr 2010 03:51:13 +0000 (UTC) From: Randall Stewart <rrs@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r206729 - stable/8/sys/netinet Message-ID: <201004170351.o3H3pDav038587@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rrs Date: Sat Apr 17 03:51:13 2010 New Revision: 206729 URL: http://svn.freebsd.org/changeset/base/206729 Log: MFC of 202523 This fixes a closing race condition that is unlikely to ever happen.. but good to fix ;-) Modified: stable/8/sys/netinet/sctp_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Sat Apr 17 03:49:21 2010 (r206728) +++ stable/8/sys/netinet/sctp_usrreq.c Sat Apr 17 03:51:13 2010 (r206729) @@ -551,6 +551,7 @@ sctp_attach(struct socket *so, int proto sctp_log_closing(inp, NULL, 17); #endif if (error != 0) { +try_again: flags = inp->sctp_flags; if (((flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) && (atomic_cmpset_int(&inp->sctp_flags, flags, (flags | SCTP_PCB_FLAGS_SOCKET_GONE | SCTP_PCB_FLAGS_CLOSE_IP)))) { @@ -561,7 +562,12 @@ sctp_attach(struct socket *so, int proto sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_ABORT, SCTP_CALLED_AFTER_CMPSET_OFCLOSE); } else { - SCTP_INP_WUNLOCK(inp); + flags = inp->sctp_flags; + if ((flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) { + goto try_again; + } else { + SCTP_INP_WUNLOCK(inp); + } } return error; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004170351.o3H3pDav038587>