[kernel/f17] Fix issues in nx crypto driver from Kent Yoder (rhbz 916544)

Josh Boyer jwboyer at fedoraproject.org
Mon Mar 4 18:40:37 UTC 2013


commit 5a61b3c3be7517751ef20fdf72acfc9b76eb724b
Author: Josh Boyer <jwboyer at redhat.com>
Date:   Mon Mar 4 13:38:45 2013 -0500

    Fix issues in nx crypto driver from Kent Yoder (rhbz 916544)

 ...pto-nx-fix-init-race-alignmasks-and-GCM-b.patch |   83 ++++++++++++++++++++
 kernel.spec                                        |   13 +++-
 2 files changed, 94 insertions(+), 2 deletions(-)
---
diff --git a/0001-drivers-crypto-nx-fix-init-race-alignmasks-and-GCM-b.patch b/0001-drivers-crypto-nx-fix-init-race-alignmasks-and-GCM-b.patch
new file mode 100644
index 0000000..c8d3045
--- /dev/null
+++ b/0001-drivers-crypto-nx-fix-init-race-alignmasks-and-GCM-b.patch
@@ -0,0 +1,83 @@
+From b05ceba560e094d27ff716f6df1e2d5ef670d4d3 Mon Sep 17 00:00:00 2001
+From: Kent Yoder <key at linux.vnet.ibm.com>
+Date: Wed, 27 Feb 2013 15:50:27 -0600
+Subject: [PATCH] drivers/crypto/nx: fix init race, alignmasks and GCM bug
+
+  Fixes a race on driver init with registering algorithms where the
+driver status flag wasn't being set before self testing started.
+
+  Added the cra_alignmask field for CBC and ECB modes.
+
+  Fixed a bug in GCM where AES block size was being used instead of
+authsize.
+
+Signed-off-by: Kent Yoder <key at linux.vnet.ibm.com>
+---
+ drivers/crypto/nx/nx-aes-cbc.c | 1 +
+ drivers/crypto/nx/nx-aes-ecb.c | 1 +
+ drivers/crypto/nx/nx-aes-gcm.c | 2 +-
+ drivers/crypto/nx/nx.c         | 4 ++--
+ 4 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/crypto/nx/nx-aes-cbc.c b/drivers/crypto/nx/nx-aes-cbc.c
+index a76d4c4..35d483f 100644
+--- a/drivers/crypto/nx/nx-aes-cbc.c
++++ b/drivers/crypto/nx/nx-aes-cbc.c
+@@ -126,6 +126,7 @@ struct crypto_alg nx_cbc_aes_alg = {
+ 	.cra_blocksize   = AES_BLOCK_SIZE,
+ 	.cra_ctxsize     = sizeof(struct nx_crypto_ctx),
+ 	.cra_type        = &crypto_blkcipher_type,
++	.cra_alignmask   = 0xf,
+ 	.cra_module      = THIS_MODULE,
+ 	.cra_init        = nx_crypto_ctx_aes_cbc_init,
+ 	.cra_exit        = nx_crypto_ctx_exit,
+diff --git a/drivers/crypto/nx/nx-aes-ecb.c b/drivers/crypto/nx/nx-aes-ecb.c
+index ba5f161..7bbc9a8 100644
+--- a/drivers/crypto/nx/nx-aes-ecb.c
++++ b/drivers/crypto/nx/nx-aes-ecb.c
+@@ -123,6 +123,7 @@ struct crypto_alg nx_ecb_aes_alg = {
+ 	.cra_priority    = 300,
+ 	.cra_flags       = CRYPTO_ALG_TYPE_BLKCIPHER,
+ 	.cra_blocksize   = AES_BLOCK_SIZE,
++	.cra_alignmask   = 0xf,
+ 	.cra_ctxsize     = sizeof(struct nx_crypto_ctx),
+ 	.cra_type        = &crypto_blkcipher_type,
+ 	.cra_module      = THIS_MODULE,
+diff --git a/drivers/crypto/nx/nx-aes-gcm.c b/drivers/crypto/nx/nx-aes-gcm.c
+index c8109ed..6cca6c3 100644
+--- a/drivers/crypto/nx/nx-aes-gcm.c
++++ b/drivers/crypto/nx/nx-aes-gcm.c
+@@ -219,7 +219,7 @@ static int gcm_aes_nx_crypt(struct aead_request *req, int enc)
+ 	if (enc)
+ 		NX_CPB_FDM(csbcpb) |= NX_FDM_ENDE_ENCRYPT;
+ 	else
+-		nbytes -= AES_BLOCK_SIZE;
++		nbytes -= crypto_aead_authsize(crypto_aead_reqtfm(req));
+ 
+ 	csbcpb->cpb.aes_gcm.bit_length_data = nbytes * 8;
+ 
+diff --git a/drivers/crypto/nx/nx.c b/drivers/crypto/nx/nx.c
+index c767f23..7621d05 100644
+--- a/drivers/crypto/nx/nx.c
++++ b/drivers/crypto/nx/nx.c
+@@ -454,6 +454,8 @@ static int nx_register_algs(void)
+ 	if (rc)
+ 		goto out;
+ 
++	nx_driver.of.status = NX_OKAY;
++
+ 	rc = crypto_register_alg(&nx_ecb_aes_alg);
+ 	if (rc)
+ 		goto out;
+@@ -498,8 +500,6 @@ static int nx_register_algs(void)
+ 	if (rc)
+ 		goto out_unreg_s512;
+ 
+-	nx_driver.of.status = NX_OKAY;
+-
+ 	goto out;
+ 
+ out_unreg_s512:
+-- 
+1.7.11.7
+
diff --git a/kernel.spec b/kernel.spec
index 5e804ab..5575560 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -54,7 +54,7 @@ Summary: The Linux kernel
 # For non-released -rc kernels, this will be appended after the rcX and
 # gitX tags, so a 3 here would become part of release "0.rcX.gitX.3"
 #
-%global baserelease 101
+%global baserelease 102
 %global fedora_build %{baserelease}
 
 # base_sublevel is the kernel version we're starting with and patching
@@ -731,6 +731,9 @@ Patch22261: 0001-kmsg-Honor-dmesg_restrict-sysctl-on-dev-kmsg.patch
 #rhbz 914737
 Patch22262: x86-mm-Fix-vmalloc_fault-oops-during-lazy-MMU-updates.patch
 
+#rhbz 916544
+Patch22263: 0001-drivers-crypto-nx-fix-init-race-alignmasks-and-GCM-b.patch
+
 #rhbz 812111
 Patch24000: alps.patch
 
@@ -1431,6 +1434,9 @@ ApplyPatch 0001-kmsg-Honor-dmesg_restrict-sysctl-on-dev-kmsg.patch
 #rhbz 914737
 ApplyPatch x86-mm-Fix-vmalloc_fault-oops-during-lazy-MMU-updates.patch
 
+#rhbz 916544
+ApplyPatch 0001-drivers-crypto-nx-fix-init-race-alignmasks-and-GCM-b.patch
+
 ApplyPatch userns-avoid-recursion-in-put_user_ns.patch
 
 # END OF PATCH APPLICATIONS
@@ -2288,10 +2294,13 @@ fi
 #    '-'      |  |
 #              '-'
 %changelog
+* Mon Mar 04 2013 Josh Boyer <jwboyer at redhat.com>
+- Fix issues in nx crypto driver from Kent Yoder (rhbz 916544)
+
 * Mon Mar 04 2013 Justin M. Forbes <jforbes at redhat.com>
 - Add audit-libs-devel to perf build-deps to enable trace command. (rhbz 892893)
 
-* Mon Mar 04 2013 Josh Boyer <jwboyer at redhat.com> - 3.8.2-101
+* Mon Mar 04 2013 Josh Boyer <jwboyer at redhat.com>
 - Linux v3.8.2
 
 * Fri Mar 01 2013 Justin M. Forbes <jforbes at redhat.com> - 3.8.1-101


More information about the scm-commits mailing list