[PATCH net-next] calipso: hash the cache key, not the option start, in calipso_cache_add()

Paul Moore paul at paul-moore.com
Tue Oct 13 20:03:23 UTC 2026


On Tue, Oct 13, 2026 at 6:10 AM <patchwork-bot+netdevbpf at kernel.org> wrote:
>
> Hello:
>
> This patch was applied to netdev/net-next.git (main)
> by Paolo Abeni <pabeni at redhat.com>:
>
> On Wed, 07 Oct 2026 12:25:00 -0300 you wrote:
> > calipso_cache_add() stores calipso_ptr + 2 as the cache key, but
> > computes entry->hash over calipso_ptr, i.e. starting two bytes earlier
> > at the option type and length.  calipso_opt_getattr() looks entries up
> > with calipso_cache_check(calipso + 2, calipso[1], ...), which hashes the
> > key itself.
> >
> > The two hashes only match on a jhash collision, so the CALIPSO label
> > cache never hits and every labelled packet takes the full DOI lookup and
> > category conversion path.  The memcmp() on the key keeps lookups
> > correct, so this is a performance bug only.
> >
> > [...]
>
> Here is the summary with links:
>   - [net-next] calipso: hash the cache key, not the option start, in calipso_cache_add()
>     https://git.kernel.org/netdev/net-next/c/d538cc3ec0bc
>
> You are awesome, thank you!

My apologies, travel last week for LPC and LSS-EU has me a bit behind,
but this patch looks good to me.  Thanks for identifying the problem
and providing a fix!

Likely too late, but for the sake of posterity ...

Acked-by: Paul Moore <paul at paul-moore.com>

-- 
paul-moore.com



More information about the Linux-security-module-archive mailing list