aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/dm-crypt.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 00725d1863d5..64ffa0ea8ca4 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -771,7 +771,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
771 771
772 if (crypt_set_key(cc, argv[1])) { 772 if (crypt_set_key(cc, argv[1])) {
773 ti->error = "Error decoding key"; 773 ti->error = "Error decoding key";
774 goto bad1; 774 goto bad_cipher;
775 } 775 }
776 776
777 /* Compatiblity mode for old dm-crypt cipher strings */ 777 /* Compatiblity mode for old dm-crypt cipher strings */
@@ -782,19 +782,19 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
782 782
783 if (strcmp(chainmode, "ecb") && !ivmode) { 783 if (strcmp(chainmode, "ecb") && !ivmode) {
784 ti->error = "This chaining mode requires an IV mechanism"; 784 ti->error = "This chaining mode requires an IV mechanism";
785 goto bad1; 785 goto bad_cipher;
786 } 786 }
787 787
788 if (snprintf(cc->cipher, CRYPTO_MAX_ALG_NAME, "%s(%s)", 788 if (snprintf(cc->cipher, CRYPTO_MAX_ALG_NAME, "%s(%s)",
789 chainmode, cipher) >= CRYPTO_MAX_ALG_NAME) { 789 chainmode, cipher) >= CRYPTO_MAX_ALG_NAME) {
790 ti->error = "Chain mode + cipher name is too long"; 790 ti->error = "Chain mode + cipher name is too long";
791 goto bad1; 791 goto bad_cipher;
792 } 792 }
793 793
794 tfm = crypto_alloc_blkcipher(cc->cipher, 0, CRYPTO_ALG_ASYNC); 794 tfm = crypto_alloc_blkcipher(cc->cipher, 0, CRYPTO_ALG_ASYNC);
795 if (IS_ERR(tfm)) { 795 if (IS_ERR(tfm)) {
796 ti->error = "Error allocating crypto tfm"; 796 ti->error = "Error allocating crypto tfm";
797 goto bad1; 797 goto bad_cipher;
798 } 798 }
799 799
800 strcpy(cc->cipher, cipher); 800 strcpy(cc->cipher, cipher);
@@ -818,12 +818,12 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
818 cc->iv_gen_ops = &crypt_iv_null_ops; 818 cc->iv_gen_ops = &crypt_iv_null_ops;
819 else { 819 else {
820 ti->error = "Invalid IV mode"; 820 ti->error = "Invalid IV mode";
821 goto bad2; 821 goto bad_ivmode;
822 } 822 }
823 823
824 if (cc->iv_gen_ops && cc->iv_gen_ops->ctr && 824 if (cc->iv_gen_ops && cc->iv_gen_ops->ctr &&
825 cc->iv_gen_ops->ctr(cc, ti, ivopts) < 0) 825 cc->iv_gen_ops->ctr(cc, ti, ivopts) < 0)
826 goto bad2; 826 goto bad_ivmode;
827 827
828 cc->iv_size = crypto_blkcipher_ivsize(tfm); 828 cc->iv_size = crypto_blkcipher_ivsize(tfm);
829 if (cc->iv_size) 829 if (cc->iv_size)
@@ -842,13 +842,13 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
842 cc->io_pool = mempool_create_slab_pool(MIN_IOS, _crypt_io_pool); 842 cc->io_pool = mempool_create_slab_pool(MIN_IOS, _crypt_io_pool);
843 if (!cc->io_pool) { 843 if (!cc->io_pool) {
844 ti->error = "Cannot allocate crypt io mempool"; 844 ti->error = "Cannot allocate crypt io mempool";
845 goto bad3; 845 goto bad_slab_pool;
846 } 846 }
847 847
848 cc->page_pool = mempool_create_page_pool(MIN_POOL_PAGES, 0); 848 cc->page_pool = mempool_create_page_pool(MIN_POOL_PAGES, 0);
849 if (!cc->page_pool) { 849 if (!cc->page_pool) {
850 ti->error = "Cannot allocate page mempool"; 850 ti->error = "Cannot allocate page mempool";
851 goto bad4; 851 goto bad_page_pool;
852 } 852 }
853 853
854 cc->bs = bioset_create(MIN_IOS, MIN_IOS); 854 cc->bs = bioset_create(MIN_IOS, MIN_IOS);
@@ -859,25 +859,25 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
859 859
860 if (crypto_blkcipher_setkey(tfm, cc->key, key_size) < 0) { 860 if (crypto_blkcipher_setkey(tfm, cc->key, key_size) < 0) {
861 ti->error = "Error setting key"; 861 ti->error = "Error setting key";
862 goto bad5; 862 goto bad_device;
863 } 863 }
864 864
865 if (sscanf(argv[2], "%llu", &tmpll) != 1) { 865 if (sscanf(argv[2], "%llu", &tmpll) != 1) {
866 ti->error = "Invalid iv_offset sector"; 866 ti->error = "Invalid iv_offset sector";
867 goto bad5; 867 goto bad_device;
868 } 868 }
869 cc->iv_offset = tmpll; 869 cc->iv_offset = tmpll;
870 870
871 if (sscanf(argv[4], "%llu", &tmpll) != 1) { 871 if (sscanf(argv[4], "%llu", &tmpll) != 1) {
872 ti->error = "Invalid device sector"; 872 ti->error = "Invalid device sector";
873 goto bad5; 873 goto bad_device;
874 } 874 }
875 cc->start = tmpll; 875 cc->start = tmpll;
876 876
877 if (dm_get_device(ti, argv[3], cc->start, ti->len, 877 if (dm_get_device(ti, argv[3], cc->start, ti->len,
878 dm_table_get_mode(ti->table), &cc->dev)) { 878 dm_table_get_mode(ti->table), &cc->dev)) {
879 ti->error = "Device lookup failed"; 879 ti->error = "Device lookup failed";
880 goto bad5; 880 goto bad_device;
881 } 881 }
882 882
883 if (ivmode && cc->iv_gen_ops) { 883 if (ivmode && cc->iv_gen_ops) {
@@ -886,7 +886,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
886 cc->iv_mode = kmalloc(strlen(ivmode) + 1, GFP_KERNEL); 886 cc->iv_mode = kmalloc(strlen(ivmode) + 1, GFP_KERNEL);
887 if (!cc->iv_mode) { 887 if (!cc->iv_mode) {
888 ti->error = "Error kmallocing iv_mode string"; 888 ti->error = "Error kmallocing iv_mode string";
889 goto bad_iv_mode; 889 goto bad_ivmode_string;
890 } 890 }
891 strcpy(cc->iv_mode, ivmode); 891 strcpy(cc->iv_mode, ivmode);
892 } else 892 } else
@@ -911,20 +911,20 @@ bad_crypt_queue:
911 destroy_workqueue(cc->io_queue); 911 destroy_workqueue(cc->io_queue);
912bad_io_queue: 912bad_io_queue:
913 kfree(cc->iv_mode); 913 kfree(cc->iv_mode);
914bad_iv_mode: 914bad_ivmode_string:
915 dm_put_device(ti, cc->dev); 915 dm_put_device(ti, cc->dev);
916bad5: 916bad_device:
917 bioset_free(cc->bs); 917 bioset_free(cc->bs);
918bad_bs: 918bad_bs:
919 mempool_destroy(cc->page_pool); 919 mempool_destroy(cc->page_pool);
920bad4: 920bad_page_pool:
921 mempool_destroy(cc->io_pool); 921 mempool_destroy(cc->io_pool);
922bad3: 922bad_slab_pool:
923 if (cc->iv_gen_ops && cc->iv_gen_ops->dtr) 923 if (cc->iv_gen_ops && cc->iv_gen_ops->dtr)
924 cc->iv_gen_ops->dtr(cc); 924 cc->iv_gen_ops->dtr(cc);
925bad2: 925bad_ivmode:
926 crypto_free_blkcipher(tfm); 926 crypto_free_blkcipher(tfm);
927bad1: 927bad_cipher:
928 /* Must zero key material before freeing */ 928 /* Must zero key material before freeing */
929 memset(cc, 0, sizeof(*cc) + cc->key_size * sizeof(u8)); 929 memset(cc, 0, sizeof(*cc) + cc->key_size * sizeof(u8));
930 kfree(cc); 930 kfree(cc);