Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Feb 2009 20:33:28 +0000 (UTC)
From:      Randall Stewart <rrs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r188100 - head/sys/netinet
Message-ID:  <200902032033.n13KXSrY041231@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rrs
Date: Tue Feb  3 20:33:28 2009
New Revision: 188100
URL: http://svn.freebsd.org/changeset/base/188100

Log:
  LOR fix - Lock only when calling the actual code that
            is messing with the UDP tunnel. This means
            that if two users actually tried to change the
            tunnel port at the same time interesting things COULD
            result, but its probably very unlikely to happen :-)

Modified:
  head/sys/netinet/sctp_sysctl.c

Modified: head/sys/netinet/sctp_sysctl.c
==============================================================================
--- head/sys/netinet/sctp_sysctl.c	Tue Feb  3 20:31:26 2009	(r188099)
+++ head/sys/netinet/sctp_sysctl.c	Tue Feb  3 20:33:28 2009	(r188100)
@@ -519,8 +519,9 @@ sysctl_sctp_udp_tunneling_check(SYSCTL_H
 	int error;
 	uint32_t old_sctp_udp_tunneling_port;
 
-	SCTP_INP_INFO_WLOCK();
+	SCTP_INP_INFO_RLOCK();
 	old_sctp_udp_tunneling_port = SCTP_BASE_SYSCTL(sctp_udp_tunneling_port);
+	SCTP_INP_INFO_RUNLOCK();
 	error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
 	if (error == 0) {
 		RANGECHK(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port), SCTPCTL_UDP_TUNNELING_PORT_MIN, SCTPCTL_UDP_TUNNELING_PORT_MAX);
@@ -528,6 +529,7 @@ sysctl_sctp_udp_tunneling_check(SYSCTL_H
 			error = 0;
 			goto out;
 		}
+		SCTP_INP_INFO_WLOCK();
 		if (old_sctp_udp_tunneling_port) {
 			sctp_over_udp_stop();
 		}
@@ -536,9 +538,9 @@ sysctl_sctp_udp_tunneling_check(SYSCTL_H
 				SCTP_BASE_SYSCTL(sctp_udp_tunneling_port) = 0;
 			}
 		}
+		SCTP_INP_INFO_WUNLOCK();
 	}
 out:
-	SCTP_INP_INFO_WUNLOCK();
 	return (error);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902032033.n13KXSrY041231>