Skip to content
  • Evgeniy Dushistov's avatar
    [PATCH] ufs: write to hole in big file · c37336b0
    Evgeniy Dushistov authored
    
    
    On UFS, this scenario:
    	open(O_TRUNC)
    	lseek(1024 * 1024 * 80)
    	write("A")
    	lseek(1024 * 2)
    	write("A")
    
    may cause access to invalid address.
    
    This happened because of "goal" is calculated in wrong way in block
    allocation path, as I see this problem exists also in 2.4.
    
    We use construction like this i_data[lastfrag], i_data array of pointers to
    direct blocks, indirect and so on, it has ceratain size ~20 elements, and
    lastfrag may have value for example 40000.
    
    Also this patch fixes related to handling such scenario issues, wrong
    zeroing metadata, in case of block(not fragment) allocation, and wrong goal
    calculation, when we allocate block
    
    Signed-off-by: default avatarEvgeniy Dushistov <dushistov@mail.ru>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    c37336b0