dm crypt: fix crypt_ctr_cipher_new return value on invalid AEAD cipher
authorMikulas Patocka <mpatocka@redhat.com>
Wed, 24 May 2023 09:35:29 +0000 (05:35 -0400)
committerMike Snitzer <snitzer@kernel.org>
Fri, 16 Jun 2023 22:24:13 +0000 (18:24 -0400)
If the user specifies invalid AEAD cipher, dm-crypt should return the
error returned from crypt_ctr_auth_spec, not -ENOMEM.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
drivers/md/dm-crypt.c

index dbf13bd1d2190461d0b71719717981e8290eb584..98622a15df30042d1885ffdcccbd9dcc41e31866 100644 (file)
@@ -2908,7 +2908,7 @@ static int crypt_ctr_cipher_new(struct dm_target *ti, char *cipher_in, char *key
                ret = crypt_ctr_auth_cipher(cc, cipher_api);
                if (ret < 0) {
                        ti->error = "Invalid AEAD cipher spec";
-                       return -ENOMEM;
+                       return ret;
                }
        }