pf: ensure we don't destroy an uninitialised lock
The new lock introduced in 5f5e32f1b3 needs to be initialised early so that it can be safely destroyed if we error out. Reported-by: syzbot+d76113e9a4ae0c0fcac2@syzkaller.appspotmail.com MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate")
This commit is contained in:
parent
340cebe990
commit
e5ca5e801d
@ -1862,6 +1862,8 @@ pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket,
|
||||
int rs_num;
|
||||
int error = 0;
|
||||
|
||||
mtx_init(&rule->rpool.mtx, "pf_krule_pool", NULL, MTX_DEF);
|
||||
|
||||
if ((rule->return_icmp >> 8) > ICMP_MAXTYPE) {
|
||||
error = EINVAL;
|
||||
goto errout_unlocked;
|
||||
@ -2002,7 +2004,6 @@ pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket,
|
||||
rule, entries);
|
||||
ruleset->rules[rs_num].inactive.rcount++;
|
||||
|
||||
mtx_init(&rule->rpool.mtx, "pf_krule_pool", NULL, MTX_DEF);
|
||||
PF_RULES_WUNLOCK();
|
||||
|
||||
return (0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user