On Mon, Mar 21, 2022 at 11:48:48PM +0100, Alexandr Nedvedicky wrote: > OK?
I did a regress run with witness. OK bluhm@ > --------8<---------------8<---------------8<------------------8<-------- > diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c > index dbbc79c0a0e..329284ce6a6 100644 > --- a/sys/net/pf_ioctl.c > +++ b/sys/net/pf_ioctl.c > @@ -150,6 +150,7 @@ TAILQ_HEAD(pf_tags, pf_tagname) pf_tags = > TAILQ_HEAD_INITIALIZER(pf_tags), > */ > struct rwlock pf_lock = RWLOCK_INITIALIZER("pf_lock"); > struct rwlock pf_state_lock = > RWLOCK_INITIALIZER("pf_state_lock"); > +struct rwlock pfioctl_rw = RWLOCK_INITIALIZER("pfioctl_rw"); > > #if (PF_QNAME_SIZE != PF_TAG_NAME_SIZE) > #error PF_QNAME_SIZE must be equal to PF_TAG_NAME_SIZE > @@ -1142,6 +1143,11 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int > flags, struct proc *p) > return (EACCES); > } > > + if (flags & FWRITE) > + rw_enter_write(&pfioctl_rw); > + else > + rw_enter_read(&pfioctl_rw); > + > switch (cmd) { > > case DIOCSTART: > @@ -2945,8 +2951,10 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int > flags, struct proc *p) > case DIOCSETIFFLAG: { > struct pfioc_iface *io = (struct pfioc_iface *)addr; > > - if (io == NULL) > - return (EINVAL); > + if (io == NULL) { > + error = EINVAL; > + break; > + } > > NET_LOCK(); > PF_LOCK(); > @@ -2959,8 +2967,10 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int > flags, struct proc *p) > case DIOCCLRIFFLAG: { > struct pfioc_iface *io = (struct pfioc_iface *)addr; > > - if (io == NULL) > - return (EINVAL); > + if (io == NULL) { > + error = EINVAL; > + break; > + } > > NET_LOCK(); > PF_LOCK(); > @@ -3020,6 +3030,11 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int > flags, struct proc *p) > break; > } > fail: > + if (flags & FWRITE) > + rw_exit_write(&pfioctl_rw); > + else > + rw_exit_read(&pfioctl_rw); > + > return (error); > } >