summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/if_umb.c
diff options
context:
space:
mode:
authortb <tb@openbsd.org>2018-04-30 19:07:44 +0000
committertb <tb@openbsd.org>2018-04-30 19:07:44 +0000
commit19223f695fa8f28b863c452d16561cd12a6aa161 (patch)
treea4b7c0d51e16c3f18226a932dfcd8d5f6dc6e5bc /sys/dev/usb/if_umb.c
parentUse acpi_register_gpio() to register gpio space like we do for chvgpio(4). (diff)
downloadwireguard-openbsd-19223f695fa8f28b863c452d16561cd12a6aa161.tar.xz
wireguard-openbsd-19223f695fa8f28b863c452d16561cd12a6aa161.zip
Reduce the scope of the NET_LOCK() in in_control(). Two functions were
protected: mrt_ioctl() and in_ioctl(). The former has no other callers and only needs a read lock. The latter will need refactoring to reduce the lock's scope further. In a first step, establish a single exit point and protect most of the function body with the NET_LOCK() while removing the NET_LOCK() from a handful of callers. suggested by & ok mpi, ok visa
Diffstat (limited to 'sys/dev/usb/if_umb.c')
-rw-r--r--sys/dev/usb/if_umb.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/sys/dev/usb/if_umb.c b/sys/dev/usb/if_umb.c
index 36b15d3da6d..7fc04eb6113 100644
--- a/sys/dev/usb/if_umb.c
+++ b/sys/dev/usb/if_umb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_umb.c,v 1.18 2018/02/19 08:59:52 mpi Exp $ */
+/* $OpenBSD: if_umb.c,v 1.19 2018/04/30 19:07:44 tb Exp $ */
/*
* Copyright (c) 2016 genua mbH
@@ -965,7 +965,6 @@ umb_state_task(void *arg)
*/
memset(sc->sc_info.ipv4dns, 0,
sizeof (sc->sc_info.ipv4dns));
- NET_LOCK();
if (in_ioctl(SIOCGIFADDR, (caddr_t)&ifr, ifp, 1) == 0 &&
satosin(&ifr.ifr_addr)->sin_addr.s_addr !=
INADDR_ANY) {
@@ -974,7 +973,6 @@ umb_state_task(void *arg)
sizeof (ifra.ifra_addr));
in_ioctl(SIOCDIFADDR, (caddr_t)&ifra, ifp, 1);
}
- NET_UNLOCK();
}
if_link_state_change(ifp);
}
@@ -1661,9 +1659,7 @@ umb_decode_ip_configuration(struct umb_softc *sc, void *data, int len)
sin->sin_len = sizeof (ifra.ifra_mask);
in_len2mask(&sin->sin_addr, ipv4elem.prefixlen);
- NET_LOCK();
rv = in_ioctl(SIOCAIFADDR, (caddr_t)&ifra, ifp, 1);
- NET_UNLOCK();
if (rv == 0) {
if (ifp->if_flags & IFF_DEBUG)
log(LOG_INFO, "%s: IPv4 addr %s, mask %s, "