summaryrefslogtreecommitdiff
path: root/net/switchdev/switchdev.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2025-02-17 19:02:42 +0300
committerPablo Neira Ayuso <pablo@netfilter.org>2025-03-03 15:46:49 +0300
commit5cfe5612ca9590db69b9be29dc83041dbf001108 (patch)
tree9e08b0b3383f945e035f7f916caa8e4e775c6612 /net/switchdev/switchdev.c
parenta466fd7e9fafd975949e5945e2f70c33a94b1a70 (diff)
downloadlinux-5cfe5612ca9590db69b9be29dc83041dbf001108.tar.xz
netfilter: nft_ct: Use __refcount_inc() for per-CPU nft_ct_pcpu_template.
nft_ct_pcpu_template is a per-CPU variable and relies on disabled BH for its locking. The refcounter is read and if its value is set to one then the refcounter is incremented and variable is used - otherwise it is already in use and left untouched. Without per-CPU locking in local_bh_disable() on PREEMPT_RT the read-then-increment operation is not atomic and therefore racy. This can be avoided by using unconditionally __refcount_inc() which will increment counter and return the old value as an atomic operation. In case the returned counter is not one, the variable is in use and we need to decrement counter. Otherwise we can use it. Use __refcount_inc() instead of read and a conditional increment. Fixes: edee4f1e9245 ("netfilter: nft_ct: add zone id set support") Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Reviewed-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/switchdev/switchdev.c')
0 files changed, 0 insertions, 0 deletions