diff options
| author | Roman Gushchin <[email protected]> | 2023-05-02 16:08:39 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2023-06-09 23:25:13 +0000 |
| commit | f785a8f21a9cc46fced9f53c51a6f2dc647ed484 (patch) | |
| tree | 683fa0722c0137261559ac4aa04df6019abd8fcd /mm/page_alloc.c | |
| parent | mm: kmem: fix a NULL pointer dereference in obj_stock_flush_required() (diff) | |
| download | kernel-f785a8f21a9cc46fced9f53c51a6f2dc647ed484.tar.gz kernel-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/[email protected]
Signed-off-by: Roman Gushchin <[email protected]>
Acked-by: Shakeel Butt <[email protected]>
Cc: Dmitry Vyukov <[email protected]>
Cc: Yosry Ahmed <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'mm/page_alloc.c')
0 files changed, 0 insertions, 0 deletions
