• Konstantin Komarov's avatar
    fs/ntfs3: Fix case when index is reused during tree transformation · 05afeeeb
    Konstantin Komarov authored
    In most cases when adding a cluster to the directory index,
    they are placed at the end, and in the bitmap, this cluster corresponds
    to the last bit. The new directory size is calculated as follows:
    
    	data_size = (u64)(bit + 1) << indx->index_bits;
    
    In the case of reusing a non-final cluster from the index,
    data_size is calculated incorrectly, resulting in the directory size
    differing from the actual size.
    
    A check for cluster reuse has been added, and the size update is skipped.
    
    Fixes: 82cae269 ("fs/ntfs3: Add initialization of super block")
    Signed-off-by: default avatarKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
    Cc: stable@vger.kernel.org
    05afeeeb
index.c 56.6 KB