lib/percpu_counter: percpu_counter_add_batch() overflow/underflow
authorManfred Spraul <manfred@colorfullife.com>
Fri, 16 Dec 2022 15:04:39 +0000 (16:04 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 3 Feb 2023 06:50:01 +0000 (22:50 -0800)
commit805afd8300998948d16bdba0358dcfeb202a70d5
tree66b0eab28da035317de3d2d178ab680a8a76e005
parenta9dc087fd3c484fd1ed18c5efb290efaaf44ce03
lib/percpu_counter: percpu_counter_add_batch() overflow/underflow

Patch series "various irq handling fixes/docu updates".

If an interrupt happens between __this_cpu_read(*fbc->counters) and
this_cpu_add(*fbc->counters, amount), and that interrupt modifies the
per_cpu_counter, then the this_cpu_add() after the interrupt returns may
under/overflow.

Link: https://lkml.kernel.org/r/20221216150155.200389-1-manfred@colorfullife.com
Link: https://lkml.kernel.org/r/20221216150441.200533-1-manfred@colorfullife.com
Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
Cc: "Sun, Jiebin" <jiebin.sun@intel.com>
Cc: <1vier1@web.de>
Cc: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/percpu_counter.c