diff options
| author | Hao Ge <[email protected]> | 2025-10-15 14:16:42 +0000 |
|---|---|---|
| committer | Vlastimil Babka <[email protected]> | 2025-10-16 13:16:45 +0000 |
| commit | 86f54f9b6c17d6567c69e3a6fed52fdf5d7dbe93 (patch) | |
| tree | df93ba7ca1ddbc12b9e2325c364645a2c046dced /drivers/scsi/mpt2sas/mpi/mpi2_raid.h | |
| parent | slab: fix clearing freelist in free_deferred_objects() (diff) | |
| download | kernel-86f54f9b6c17d6567c69e3a6fed52fdf5d7dbe93.tar.gz kernel-86f54f9b6c17d6567c69e3a6fed52fdf5d7dbe93.zip | |
slab: reset slab->obj_ext when freeing and it is OBJEXTS_ALLOC_FAIL
If obj_exts allocation failed, slab->obj_exts is set to OBJEXTS_ALLOC_FAIL,
But we do not clear it when freeing the slab. Since OBJEXTS_ALLOC_FAIL and
MEMCG_DATA_OBJEXTS currently share the same bit position, during the
release of the associated folio, a VM_BUG_ON_FOLIO() check in
folio_memcg_kmem() is triggered because the OBJEXTS_ALLOC_FAIL flag was
not cleared, causing it to be interpreted as a kmem folio (non-slab)
with MEMCG_OBJEXTS_DATA flag set, which is invalid because
MEMCG_OBJEXTS_DATA is supposed to be set only on slabs.
Another problem that predates sharing the OBJEXTS_ALLOC_FAIL and
MEMCG_DATA_OBJEXTS bits is that on configurations with
is_check_pages_enabled(), the non-cleared bit in page->memcg_data will
trigger a free_page_is_bad() failure "page still charged to cgroup"
When freeing a slab, we clear slab->obj_exts if the obj_ext array has
been successfully allocated. So let's clear it also when the allocation
has failed.
Fixes: 09c46563ff6d ("codetag: debug: introduce OBJEXTS_ALLOC_FAIL to mark failed slab_ext allocations")
Fixes: 7612833192d5 ("slab: Reuse first bit for OBJEXTS_ALLOC_FAIL")
Link: https://lore.kernel.org/all/[email protected]/
Cc: <[email protected]>
Signed-off-by: Hao Ge <[email protected]>
Reviewed-by: Suren Baghdasaryan <[email protected]>
Reviewed-by: Harry Yoo <[email protected]>
Signed-off-by: Vlastimil Babka <[email protected]>
Diffstat (limited to 'drivers/scsi/mpt2sas/mpi/mpi2_raid.h')
0 files changed, 0 insertions, 0 deletions
