]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ext4 crypto: exit cleanly if ext4_derive_key_aes() fails
authorLaurent Navet <laurent.navet@gmail.com>
Wed, 22 Jul 2015 04:08:08 +0000 (00:08 -0400)
committerTheodore Ts'o <tytso@mit.edu>
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>
fs/ext4/crypto_key.c

index 442d24e8efc0cec6281a745384b3139433128ac4..ce75bc8b9aefef8fb33b2382e43116200eeb7c34 100644 (file)
@@ -220,6 +220,8 @@ retry:
        BUG_ON(master_key->size != EXT4_AES_256_XTS_KEY_SIZE);
        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)) {