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 {
73
73
struct {
74
74
unsigned inuse :16 ;
75
75
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
+ */
76
81
unsigned frozen :1 ;
77
82
};
78
83
};
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)
1409
1409
slab -> inuse , slab -> objects );
1410
1410
return 0 ;
1411
1411
}
1412
+ if (slab -> frozen ) {
1413
+ slab_err (s , slab , "Slab disabled since SLUB metadata consistency check failed" );
1414
+ return 0 ;
1415
+ }
1416
+
1412
1417
/* Slab_pad_check fixes things up after itself */
1413
1418
slab_pad_check (s , slab );
1414
1419
return 1 ;
@@ -1589,6 +1594,7 @@ static noinline bool alloc_debug_processing(struct kmem_cache *s,
1589
1594
slab_fix (s , "Marking all objects used" );
1590
1595
slab -> inuse = slab -> objects ;
1591
1596
slab -> freelist = NULL ;
1597
+ slab -> frozen = 1 ; /* mark consistency-failed slab as frozen */
1592
1598
}
1593
1599
return false;
1594
1600
}
@@ -2730,7 +2736,8 @@ static void *alloc_single_from_partial(struct kmem_cache *s,
2730
2736
slab -> inuse ++ ;
2731
2737
2732
2738
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 );
2734
2741
return NULL ;
2735
2742
}
2736
2743
You can’t perform that action at this time.
0 commit comments