On Sat, May 08, 2021 at 12:31:50AM +0200, Alexandr Nedvedicky wrote:
> Hello,
> 
> thank you very much for doing the test for me.
> patch below should kill the bug.
> 
> patch applies to current.

I confirm that since 4 days the host is stable without any issues.

Your diff is ok semarie@

Thanks !

> 
> --------8<---------------8<---------------8<------------------8<--------
> diff --git a/sys/net/pf.c b/sys/net/pf.c
> index 23eebf4a274..275ef8a6157 100644
> --- a/sys/net/pf.c
> +++ b/sys/net/pf.c
> @@ -7376,11 +7376,15 @@ pf_state_key_link_reverse(struct pf_state_key *sk, 
> struct pf_state_key *skrev)
>       else
>               pf_state_key_ref(skrev);
>  
> +     /*
> +      * NOTE: if sk == skrev, then KASSERT() below holds true. We still
> +      * want to grab a reference in such case.
> +      */
>       old_reverse = atomic_cas_ptr(&skrev->reverse, NULL, sk);
>       if (old_reverse != NULL)
>               KASSERT(old_reverse == sk);
> -     else
> -             pf_state_key_ref(sk);
> +
> +     pf_state_key_ref(sk);
>  }
>  
>  #if NPFLOG > 0

-- 
Sebastien Marie

Reply via email to