fscrypt: clean up some BUG_ON()s in block encryption/decryption
authorEric Biggers <ebiggers@google.com>
Mon, 20 May 2019 16:29:42 +0000 (09:29 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jul 2019 07:14:02 +0000 (09:14 +0200)
commit71b029a5d9085b629763beb64024e4547e04f4bf
treed1ba9d7dbf2afea2a5e0ece391e631c661ebec95
parent2c6acf7478aacce620866fc1720d70287c9af934
fscrypt: clean up some BUG_ON()s in block encryption/decryption

[ Upstream commit eeacfdc68a104967162dfcba60f53f6f5b62a334 ]

Replace some BUG_ON()s with WARN_ON_ONCE() and returning an error code,
and move the check for len divisible by FS_CRYPTO_BLOCK_SIZE into
fscrypt_crypt_block() so that it's done for both encryption and
decryption, not just encryption.

Reviewed-by: Chandan Rajendra <chandan@linux.ibm.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/crypto/crypto.c