From 99ae0d529b6d032ce4069677ab2067bf7b453da4 Mon Sep 17 00:00:00 2001 From: mvs Date: Thu, 1 Apr 2021 08:39:52 +0000 Subject: [PATCH] Push kernel lock down to umb_rtrequest(). We are going to unlock PF_ROUTE sockets. This means `if_rtrequest' handler will be performed without kernel lock. umb_rtrequest() calls umb_send_inet_proposal() which touches kernel lock protected `ipv{4,6}dns' array. Also umb_rtrequest() is the only handler which requires kernel lock to be held. So push the lock down to umb_rtrequest() instead of grab it around `if_rtrequest' call. This hunk was commited separately for decreases PF_ROUTE sockets unlocking diff. ok gerhard@ deraadt@ --- sys/dev/usb/if_umb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/dev/usb/if_umb.c b/sys/dev/usb/if_umb.c index 655a7f5829e..eba04afddfc 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.42 2021/03/30 20:58:19 sthen Exp $ */ +/* $OpenBSD: if_umb.c,v 1.43 2021/04/01 08:39:52 mvs Exp $ */ /* * Copyright (c) 2016 genua mbH @@ -1053,10 +1053,12 @@ umb_rtrequest(struct ifnet *ifp, int req, struct rtentry *rt) struct umb_softc *sc = ifp->if_softc; if (req == RTM_PROPOSAL) { + KERNEL_LOCK(); umb_send_inet_proposal(sc, AF_INET); #ifdef INET6 umb_send_inet_proposal(sc, AF_INET6); #endif + KERNEL_UNLOCK(); return; } -- 2.20.1