Commit a21fe7b
committed
slab: validate slab before using it in alloc_single_from_partial()
We touch slab->freelist and slab->inuse before checking the slab pointer
is actually sane. Do that validation first, which will be safer. We can
thus also remove the check from alloc_debug_processing().
This adds a new "s->flags & SLAB_CONSISTENCY_CHECKS" test but
alloc_single_from_partial() is only called for caches with debugging
enabled so it's acceptable.
In alloc_single_from_new_slab() we just created the struct slab and call
alloc_debug_processing() to mainly set up redzones, tracking etc, while
not really expecting the consistency checks to fail. Thus don't validate
it there.
Reviewed-by: Harry Yoo <[email protected]>
Signed-off-by: Vlastimil Babka <[email protected]>1 parent 40522db commit a21fe7b
1 file changed
Lines changed: 12 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
821 | 821 | | |
822 | 822 | | |
823 | 823 | | |
| 824 | + | |
| 825 | + | |
824 | 826 | | |
825 | 827 | | |
826 | 828 | | |
| |||
830 | 832 | | |
831 | 833 | | |
832 | 834 | | |
833 | | - | |
834 | 835 | | |
835 | 836 | | |
836 | 837 | | |
| |||
1651 | 1652 | | |
1652 | 1653 | | |
1653 | 1654 | | |
1654 | | - | |
1655 | | - | |
1656 | | - | |
1657 | | - | |
1658 | | - | |
1659 | 1655 | | |
1660 | 1656 | | |
1661 | 1657 | | |
| |||
2825 | 2821 | | |
2826 | 2822 | | |
2827 | 2823 | | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
2828 | 2833 | | |
2829 | 2834 | | |
2830 | 2835 | | |
2831 | 2836 | | |
2832 | 2837 | | |
2833 | | - | |
2834 | | - | |
| 2838 | + | |
2835 | 2839 | | |
2836 | 2840 | | |
2837 | 2841 | | |
| |||
0 commit comments