]> www.infradead.org Git - users/jedix/linux-maple.git/commit
lib/stackdepot: annotate racy pool_index accesses
authorAndrey Konovalov <andreyknvl@google.com>
Fri, 10 Feb 2023 21:16:04 +0000 (22:16 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 10 Feb 2023 23:36:13 +0000 (15:36 -0800)
commitda24ca3e08c90198d25db17ec3e520db43514c33
tree94a0e88c3ee6fb49c28ebbfca3d5530881902de6
parentbee982bfc8bbe33d0ca274335b7ab935cf2c3fa0
lib/stackdepot: annotate racy pool_index accesses

Accesses to pool_index are protected by pool_lock everywhere except
in a sanity check in stack_depot_fetch. The read access there can race
with the write access in depot_alloc_stack.

Use WRITE/READ_ONCE() to annotate the racy accesses.

As the sanity check is only used to print a warning in case of a
violation of the stack depot interface usage, it does not make a lot
of sense to use proper synchronization.

Link: https://lkml.kernel.org/r/359ac9c13cd0869c56740fb2029f505e41593830.1676063693.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/stackdepot.c