ext4 crypto: exit cleanly if ext4_derive_key_aes() fails
Laurent Navet [Wed, 22 Jul 2015 04:08:08 +0000 (00:08 -0400)]
Return value of ext4_derive_key_aes() is stored but not used.
Add test to exit cleanly if ext4_derive_key_aes() fail.
Also fix coverity CID 1309760.

Signed-off-by: Laurent Navet <laurent.navet@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: "Theodore Ts'o" <tytso@google.com>
Change-Id: I796cdfc65386e546f332a3dbbf9f2c2cd76e3301
Reviewed-on: http://git-master/r/1154517
Reviewed-by: Ian Chang <ianc@nvidia.com>
Tested-by: Ian Chang <ianc@nvidia.com>

fs/ext4/crypto_key.c

index 9bdc387..20f2959 100644 (file)
@@ -230,6 +230,8 @@ retry:
        }
        res = ext4_derive_key_aes(ctx.nonce, master_key->raw,
                                  raw_key);
+       if (res)
+               goto out;
 got_key:
        ctfm = crypto_alloc_ablkcipher(cipher_str, 0, 0);
        if (!ctfm || IS_ERR(ctfm)) {