Fixes for filename decryption and encrypted view plus a cleanup
- The filename decryption routines were, at times, writing a zero byte one
  character past the end of the filename buffer
- The encrypted view feature attempted, and failed, to roll its own form of
  enforcing a read-only mount instead of letting the VFS enforce it
eCryptfs: Remove buggy and unnecessary write in file name decode routine

Dmitry Chernenkov used KASAN to discover that eCryptfs writes past the
end of the allocated buffer during encrypted filename decoding. This
fix corrects the issue by getting rid of the unnecessary 0 write when
the current bit offset is 2.

Signed-off-by: Michael Halcrow <>
Reported-by: Dmitry Chernenkov <>
Suggested-by: Kees Cook <>
Cc: # v2.6.29+: 51ca58d eCryptfs: Filename Encryption: Encoding and encryption functions
Signed-off-by: Tyler Hicks <>
1 file changed