diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2018-04-30 19:07:45 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2018-04-30 19:07:45 +0000 |
commit | c5715eb7792149be764c7083fc46d6dc0081e12a (patch) | |
tree | 759d4a46814212692f13971980a70a12116b0923 /sys/dev/usb | |
parent | 896330ed72a6b6850a3911ff8f27c287e3eac9bd (diff) |
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')
-rw-r--r-- | sys/dev/usb/if_umb.c | 6 |
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, " |