Skip to content
  • Joonsoo Kim's avatar
    slab: fix the type of the index on freelist index accessor · 7cc68973
    Joonsoo Kim authored
    Commit a41adfaa ("slab: introduce byte sized index for the freelist
    of a slab") changes the size of freelist index and also changes
    prototype of accessor function to freelist index.  And there was a
    mistake.
    
    The mistake is that although it changes the size of freelist index
    correctly, it changes the size of the index of freelist index
    incorrectly.  With patch, freelist index can be 1 byte or 2 bytes, that
    means that num of object on on a slab can be more than 255.  So we need
    more than 1 byte for the index to find the index of free object on
    freelist.  But, above patch makes this index type 1 byte, so slab which
    have more than 255 objects cannot work properly and in consequence of
    it, the system cannot boot.
    
    This issue was reported by Steven King on m68knommu which would use
    2 bytes freelist index:
    
      https://lkml.org/lkml/2014/4/16/433
    
    
    
    To fix is easy.  To change the type of the index of freelist index on
    accessor functions is enough to fix this bug.  Although 2 bytes is
    enough, I use 4 bytes since it have no bad effect and make things more
    easier.  This fix was suggested and tested by Steven in his original
    report.
    
    Signed-off-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
    Reported-and-acked-by: default avatarSteven King <sfking@fdwdc.com>
    Acked-by: default avatarChristoph Lameter <cl@linux.com>
    Tested-by: default avatarJames Hogan <james.hogan@imgtec.com>
    Tested-by: default avatarDavid Miller <davem@davemloft.net>
    Cc: Pekka Enberg <penberg@kernel.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    7cc68973