svn commit: r188100 - head/sys/netinet

Randall Stewart rrs at FreeBSD.org
Tue Feb 3 12:33:29 PST 2009


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);
 }
 


More information about the svn-src-all mailing list