Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/net/npf



> Module Name:    src
> Committed By:   christos
> Date:           Sun Sep 13 23:26:26 UTC 2026
> 
> Modified Files:
>         src/sys/net/npf: npf_ext_route.c
> 
> Log Message:
> rprocs are called from a softintr, so use kmem_intr_*
> 
> @@ -87,7 +87,7 @@
>  	npf_ext_route_t *meta;
>  	const char *ifname;
>  
> -	meta = kmem_zalloc(sizeof(*meta), KM_SLEEP);
> +	meta = kmem_intr_zalloc(sizeof(*meta), KM_SLEEP);
>  	ifname = nvlist_get_string(params, "route-interface");
>  
>  	if (!ifname)

This cannot be correct.  Please revert this change and file a PR for
the issue.

It is _never_ correct -- except inside the definition of kmem_(z)alloc
itself -- to pass KM_SLEEP to kmem_intr_(z)alloc.  (Perhaps we should
factor it into _kmem_internal_(z)alloc instead so that
kmem_intr_(z)alloc can panic if the caller tried to use KM_SLEEP.)

If this code path can be run from interrupt context, hard or soft, it
MUST NOT allocate with KM_SLEEP.  This is absolutely forbidden because
attempts to do so are fundamentally prone to deadlock.  That is _why_
we have an assertion to catch the mistake.


Home | Main Index | Thread Index | Old Index