summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2009-02-03 20:33:28 +0000
committerrrs <rrs@FreeBSD.org>2009-02-03 20:33:28 +0000
commit51b2f388162c00a459b1b32449dd98b70f4a1c75 (patch)
treeb9d6cdbc7934ace565ede1925eb3965f5b1c2ccf /sys/netinet
parent5611ba088e68228cf91de2dbd18cc0081e310b30 (diff)
downloadFreeBSD-src-51b2f388162c00a459b1b32449dd98b70f4a1c75.zip
FreeBSD-src-51b2f388162c00a459b1b32449dd98b70f4a1c75.tar.gz
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 :-)
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/sctp_sysctl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/netinet/sctp_sysctl.c b/sys/netinet/sctp_sysctl.c
index 3f26125..bcba5b5 100644
--- a/sys/netinet/sctp_sysctl.c
+++ b/sys/netinet/sctp_sysctl.c
@@ -519,8 +519,9 @@ sysctl_sctp_udp_tunneling_check(SYSCTL_HANDLER_ARGS)
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_HANDLER_ARGS)
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_HANDLER_ARGS)
SCTP_BASE_SYSCTL(sctp_udp_tunneling_port) = 0;
}
}
+ SCTP_INP_INFO_WUNLOCK();
}
out:
- SCTP_INP_INFO_WUNLOCK();
return (error);
}
OpenPOWER on IntegriCloud