From 122fb2fe839734377979405c33c0f9f0bf1c5b99 Mon Sep 17 00:00:00 2001 From: cy Date: Thu, 14 Feb 2019 00:52:03 +0000 Subject: [PATCH] MFC r343591: Do not obtain an already held read lock. This causes a witness panic when ipfs is invoked. This is the second of two panics resolving PR 235110. PR: 235110 Reported by: David.Boyd49@twc.com git-svn-id: svn://svn.freebsd.org/base/stable/10@344113 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/contrib/ipfilter/netinet/ip_nat.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/ip_nat.c b/sys/contrib/ipfilter/netinet/ip_nat.c index 5d43ada07..d0b58d56d 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat.c +++ b/sys/contrib/ipfilter/netinet/ip_nat.c @@ -1909,21 +1909,17 @@ ipf_nat_getent(softc, data, getlock) } } if (error == 0) { - if (getlock) { - READ_ENTER(&softc->ipf_nat); - getlock = 0; - } error = ipf_outobjsz(softc, data, ipn, IPFOBJ_NATSAVE, ipns.ipn_dsize); } finished: - if (getlock) { - READ_ENTER(&softc->ipf_nat); - } if (ipn != NULL) { KFREES(ipn, ipns.ipn_dsize); } + if (getlock) { + RWLOCK_EXIT(&softc->ipf_nat); + } return error; } -- 2.45.0