Properly drop the pf mutex around all copyout (consistency still protected

by the sx) and avoid a WITNESS panic.  Overlooked during last import.

Reported and tested by:	Max N. Boyarov
MFC after:		3 days
This commit is contained in:
mlaier 2007-10-24 20:57:17 +00:00
parent 9ce0055163
commit 77d2172c99
2 changed files with 9 additions and 1 deletions

View File

@ -731,6 +731,9 @@ pfi_get_ifaces(const char *name, struct pfi_kif *buf, int *size)
{
struct pfi_kif *p, *nextp;
int s, n = 0;
#ifdef __FreeBSD__
int error;
#endif
s = splsoftnet();
for (p = RB_MIN(pfi_ifhead, &pfi_ifs); p; p = nextp) {
@ -741,7 +744,12 @@ pfi_get_ifaces(const char *name, struct pfi_kif *buf, int *size)
if (!p->pfik_tzero)
p->pfik_tzero = time_second;
pfi_kif_ref(p, PFI_KIF_REF_RULE);
#ifdef __FreeBSD__
PF_COPYOUT(p, buf++, sizeof(*buf), error);
if (error) {
#else
if (copyout(p, buf++, sizeof(*buf))) {
#endif
pfi_kif_unref(p, PFI_KIF_REF_RULE);
splx(s);
return (EFAULT);

View File

@ -1171,7 +1171,7 @@ pfr_walktree(struct radix_node *rn, void *arg)
struct pfr_addr ad;
pfr_copyout_addr(&ad, ke);
if (copyout(&ad, w->pfrw_addr, sizeof(ad)))
if (COPYOUT(&ad, w->pfrw_addr, sizeof(ad)))
return (EFAULT);
w->pfrw_addr++;
}