summaryrefslogtreecommitdiffstats
path: root/fs/ext4/xattr.c
diff options
context:
space:
mode:
authorAndreas Dilger <adilger@whamcloud.com>2011-10-26 03:22:31 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-10-26 03:22:31 -0400
commit909a4cf1ffe4b875c87abf38239a9bfd25167e0c (patch)
treef29e8150d7f4b840b1cc6cd143a3d957604116b9 /fs/ext4/xattr.c
parentcf8039036a6e9c5f7144841925f212a957faf1aa (diff)
downloadop-kernel-dev-909a4cf1ffe4b875c87abf38239a9bfd25167e0c.zip
op-kernel-dev-909a4cf1ffe4b875c87abf38239a9bfd25167e0c.tar.gz
ext4: avoid setting directory i_nlink to zero
If a directory with more than EXT4_LINK_MAX subdirectories, the nlink count is set to 1. Subsequently, if any subdirectories are deleted, ext4_dec_count() decrements the i_nlink count, which may go to 0 temporarily before being incremented back to 1. While this is done under i_mutex, which prevents races for directory and inode operations that check i_nlink, the temporary i_nlink == 0 case is exposed to userspace via stat() and similar calls that do not hold i_mutex. Instead, change the code to not decrement i_nlink count for any directories that do not already have i_nlink larger than 2. Reported-by: Cliff White <cliffw@whamcloud.com> Reviewed-by: Johann Lombardi <johann@whamcloud.com> Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/xattr.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud