[PATCH net] ipv6, calipso: fix data-race in calipso_cache_add() bucketsize check

sashiko-bot at kernel.org sashiko-bot at kernel.org
Sun Nov 15 14:49:28 UTC 2026


> Issue found by sashiko when reviewing my data-races patch [1]. This is
> not a plain READ_ONCE() annotation like the rest of that series but a
> real fix, so it is sent separately.
> 
> calipso_cache_add() reads calipso_cache_bucketsize twice: the "<= 0"
> guard on entry, then the "size < bucketsize" test after taking the
> bucket lock. A writer can flip it to 0 in between:
> 
>   CPU0                                    CPU1
>   calipso_cache_add()
>     calipso_cache_bucketsize == 10 (> 0)
>                                           proc_dointvec()
>                                             calipso_cache_bucketsize = 0
>     spin_lock_bh(&bucket.lock)
>     size(0) < calipso_cache_bucketsize(0) -> false
> [ ... ]
> 
> [1] https://lore.kernel.org/netdev/179428999963.994134.16904544500890053668@kernel.org/
> 
> Fixes: 4fee5242bf41 ("calipso: Add a label cache.")
> Signed-off-by: Jiayuan Chen <jiayuan.chen at linux.dev>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261115144508.71543-1-jiayuan.chen@linux.dev?part=1




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