File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,11 @@ struct slab {
7373 struct {
7474 unsigned inuse :16 ;
7575 unsigned objects :15 ;
76+ /*
77+ * If slab debugging is enabled then the
78+ * frozen bit can be reused to indicate
79+ * that the slab was corrupted
80+ */
7681 unsigned frozen :1 ;
7782 };
7883 };
Original file line number Diff line number Diff line change @@ -1409,6 +1409,11 @@ static int check_slab(struct kmem_cache *s, struct slab *slab)
14091409 slab -> inuse , slab -> objects );
14101410 return 0 ;
14111411 }
1412+ if (slab -> frozen ) {
1413+ slab_err (s , slab , "Slab disabled since SLUB metadata consistency check failed" );
1414+ return 0 ;
1415+ }
1416+
14121417 /* Slab_pad_check fixes things up after itself */
14131418 slab_pad_check (s , slab );
14141419 return 1 ;
@@ -1589,6 +1594,7 @@ static noinline bool alloc_debug_processing(struct kmem_cache *s,
15891594 slab_fix (s , "Marking all objects used" );
15901595 slab -> inuse = slab -> objects ;
15911596 slab -> freelist = NULL ;
1597+ slab -> frozen = 1 ; /* mark consistency-failed slab as frozen */
15921598 }
15931599 return false;
15941600}
@@ -2730,7 +2736,8 @@ static void *alloc_single_from_partial(struct kmem_cache *s,
27302736 slab -> inuse ++ ;
27312737
27322738 if (!alloc_debug_processing (s , slab , object , orig_size )) {
2733- remove_partial (n , slab );
2739+ if (folio_test_slab (slab_folio (slab )))
2740+ remove_partial (n , slab );
27342741 return NULL ;
27352742 }
27362743
You can’t perform that action at this time.
0 commit comments