summaryrefslogtreecommitdiffstats
path: root/mm/migrate.c
diff options
context:
space:
mode:
authorRoman Gushchin <roman.gushchin@linux.dev>2023-05-02 09:08:39 -0700
committerAndrew Morton <akpm@linux-foundation.org>2023-06-09 16:25:13 -0700
commitf785a8f21a9cc46fced9f53c51a6f2dc647ed484 (patch)
tree683fa0722c0137261559ac4aa04df6019abd8fcd /mm/migrate.c
parent3b8abb3239530c423c0b97e42af7f7e856e1ee96 (diff)
downloadlinux-f785a8f21a9cc46fced9f53c51a6f2dc647ed484.tar.gz
linux-f785a8f21a9cc46fced9f53c51a6f2dc647ed484.tar.bz2
linux-f785a8f21a9cc46fced9f53c51a6f2dc647ed484.zip
mm: memcg: use READ_ONCE()/WRITE_ONCE() to access stock->cached
A memcg pointer in the percpu stock can be accessed by drain_all_stock() from another cpu in a lockless way. In theory it might lead to an issue, similar to the one which has been discovered with stock->cached_objcg, where the pointer was zeroed between the check for being NULL and dereferencing. In this case the issue is unlikely a real problem, but to make it bulletproof and similar to stock->cached_objcg, let's annotate all accesses to stock->cached with READ_ONCE()/WTRITE_ONCE(). Link: https://lkml.kernel.org/r/20230502160839.361544-2-roman.gushchin@linux.dev Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev> Acked-by: Shakeel Butt <shakeelb@google.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Yosry Ahmed <yosryahmed@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/migrate.c')
0 files changed, 0 insertions, 0 deletions