Commit 4358dcf4 authored by Eric Biggers's avatar Eric Biggers
Browse files

ANDROID: ext4: fix encrypt+casefold support



When syncing ext4 with upstream commit f8f4acb6 ("ext4: use generic
casefolding support"), we forgot to take into account that some
additional checks for the encryption key are needed for the
encrypt+casefold support which isn't upstream yet.

(These checks for the encryption key are still racy since they happen
too late, but apparently they worked well enough...)

This bug made it impossible to delete encrypted+casefolded directories
without the encryption key, due to errors like:

    W         : EXT4-fs warning (device vdc): __ext4fs_dirhash:270: inode #49202: comm Binder:378_4: Siphash requires key

Fixes: 76bfcb2d ("ANDROID: sync generic casefolding code with patches going upstream")
Bug: 161184936
Bug: 172809853
Test: in kvm-xfstests test appliance:
      mkfs.ext4 -F -E encoding=utf8 -O encrypt /dev/vdc
      mount /vdc
      mkdir /vdc/dir
      chattr +F /vdc/dir
      keyid=$(head -c 64 /dev/zero | xfs_io -c add_enckey /vdc | awk '{print $NF}')
      xfs_io -c "set_encpolicy $keyid" /vdc/dir
      for i in `seq 1 100`; do
          mkdir /vdc/dir/$i
      done
      xfs_io -c "rm_enckey $keyid" /vdc
      rm -rf /vdc/dir # fails with the bug
Change-Id: I67fbc9e34778519b229835e1d1b784bd42006ce7
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
parent ab8a8ffd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment