• Paolo \'Blaisorblade\' Giarrusso's avatar
    [PATCH] ext3: use generic_open_file to fix possible preemption bugs · 66160bc5
    Paolo \'Blaisorblade\' Giarrusso authored
    Ext3 is currently using a duplicate version of generic_open_file, and this
    should be fixed, before it gets out of sync.
    
    In fact, it *has* got out of sync.
    
    Apart some cosmetic changes (which are not a problem), note that it
    directly reads inode->i_size, while the generic version uses i_size_read().
    
    I'm not sure if this bug can actually be triggered, but here follows a
    possible scenario: when
    
    - a file is brought into inode cache
    - that file is either truncated or extended (i.e.  inode->i_size is changed)
      and after this it changes it's "more than 2Gb" property,
    - and process B opens that file in the meanwhile,
    
    I suppose the size check can be hurted by a race condition, doesn't it?
    
    Similar checks should probably be done for other FS's. Also, ext2 does not
    have this problem - someone fixed this problem in ext2 but not ext3? How?
    Signed-off-by: default avatarPaolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    66160bc5
file.c 3.39 KB