• Chris Mason's avatar
    [PATCH] fix possible stack corruption during reiserfs_file_write · 0d8e8a6c
    Chris Mason authored
    With preallocation turned on, reiserfs_allocate_blocks_for_region wasn't
    sending a large enough array to hold all the blocks it was asking the block
    allocator to find.  This can result in stack corruption.
    
    The fix is to kmalloc an array to hold the blocks, making sure to allocate
    something large enough.
    
    There was also a recent optimization to force the allocator to find a free
    region large enough to hold the entire preallocation size.  This was
    sometimes causing more blocks to be allocated then had been requested,
    which would also overflow the array.  Something more elegant is required
    here, until then just disable the optimization.
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    0d8e8a6c
file.c 50 KB