• Shengzhe Zhao's avatar
    vfs: check if f_count is 0 or negative · 5593ce89
    Shengzhe Zhao authored
    
    
    filp_close is using !file_count(filp) to check if f_count is 0. if it is
    0, filp_close think it is a closed file then will return. However, for a
    closed file, f_count could be reduced to -1, then !file_count(filp) is
    false, filp_close will proceed to handle this file then could panic.
    This change will check if f_count is 0 or negative instead of only
    checking 0 to avoid panic.
    
    b/18200219 LRX21M: kernel_panic
    Change-Id: I3881574d4971bf4e0bc261cf3459451600ce6a27
    Signed-off-by: default avatarShengzhe Zhao <a18689@motorola.com>
    Reviewed-by: default avatarYi-Wei Zhao <gbjc64@motorola.com>
    Signed-off-by: default avatarIliyan Malchev <malchev@google.com>
    (cherry picked from commit 7e67f8fa3981561e3d614f208cfedfc508a36a27)
    
    Change-Id: I2d41ef53f128d842bee61123bf3a96144e92e953
    5593ce89