Re: Crypto Update for 4.1

2015-04-15 Thread Linus Torvalds
Oh, and I forgot to add Stephan to the email recipients list..

Sorry for the duplicate email,

  Linus

On Wed, Apr 15, 2015 at 7:37 PM, Linus Torvalds
torva...@linux-foundation.org wrote:
 On Wed, Apr 15, 2015 at 6:58 PM, Linus Torvalds
 torva...@linux-foundation.org wrote:
 On Tue, Apr 14, 2015 at 8:39 PM, Herbert Xu herb...@gondor.apana.org.au 
 wrote:

 Here is the crypto update for 4.1:

 Just a heads-up: this breaks iwlwifi for me after suspend.

 Ok, bisect completed:

 [torvalds@vaio linux]$ git bisect bad
 9c521a200bc3c12bd724e48a75c57d5358f672be is the first bad commit
 commit 9c521a200bc3c12bd724e48a75c57d5358f672be
 Author: Stephan Mueller smuel...@chronox.de
 Date:   Thu Apr 9 12:09:55 2015 +0200

 crypto: api - remove instance when test failed
 ...

 and while I have no idea *why* it breaks iwlwifi after a
 suspend/resume cycle, it is 100% repeatable. The bisect zoomed right
 to that commit, and reverting it on top of the current tree also makes
 everything work again.

 So it gets reverted. I'll be happy to test things out, but with the
 merge window *and* travel, I may or may not be quick about it.

Linus
--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Crypto Update for 4.1

2015-04-15 Thread Linus Torvalds
On Tue, Apr 14, 2015 at 8:39 PM, Herbert Xu herb...@gondor.apana.org.au wrote:

 Here is the crypto update for 4.1:

Just a heads-up: this breaks iwlwifi for me after suspend.

I'm bisecting right now. But because this laptop is what I expect to
travel with tomorrow, I will ruthlessly revert anything I find,
because I need it to work.

 Linus
--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Crypto Update for 4.1

2015-04-15 Thread Herbert Xu
On Wed, Apr 15, 2015 at 07:49:01PM -0700, Linus Torvalds wrote:
 On Wed, Apr 15, 2015 at 7:42 PM, Herbert Xu herb...@gondor.apana.org.au 
 wrote:
 
  Is CONFIG_CRYPTO_MANAGER_DISABLE_TESTS set or unset in you .config?
 
 # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
 
 I'll send you the full .config in private (no need to spam the mailing
 list) in case you have any other questions about my setup.

Thanks! It actually appears to be a very simple bug that I somehow
missed during reviewing.

---8---
The commit 9c521a200bc3c12bd724e48a75c57d5358f672be (crypto:
api - remove instance when test failed) tried to grab a module
reference count before the module was even set.  Worse, it then
goes on to free the module reference count after it is set so
you quickly end up with a negative module reference count which
prevents people from using any instances belonging to that module.

This patch moves the module initialisation before the reference
count.

Reported-by: Linus Torvalds torva...@linux-foundation.org
Signed-off-by: Herbert Xu herb...@gondor.apana.org.au

diff --git a/crypto/algapi.c b/crypto/algapi.c
index 2d0a1c6..d2627a3 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -525,12 +525,12 @@ int crypto_register_instance(struct crypto_template *tmpl,
if (err)
return err;
 
-   if (unlikely(!crypto_mod_get(inst-alg)))
-   return -EAGAIN;
-
inst-alg.cra_module = tmpl-module;
inst-alg.cra_flags |= CRYPTO_ALG_INSTANCE;
 
+   if (unlikely(!crypto_mod_get(inst-alg)))
+   return -EAGAIN;
+
down_write(crypto_alg_sem);
 
larval = __crypto_register_alg(inst-alg);
-- 
Email: Herbert Xu herb...@gondor.apana.org.au
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Crypto Update for 4.1

2015-04-15 Thread Linus Torvalds
On Wed, Apr 15, 2015 at 8:07 PM, Herbert Xu herb...@gondor.apana.org.au wrote:

 Thanks! It actually appears to be a very simple bug that I somehow
 missed during reviewing.

Ok, this patch seems to fix it for me, so I undid my revert that I
hadn't pushed out yet, and pushed out this instead.

Thanks,

Linus
--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Crypto Update for 4.1

2015-04-15 Thread Herbert Xu
On Wed, Apr 15, 2015 at 07:38:29PM -0700, Linus Torvalds wrote:

  Ok, bisect completed:
 
  [torvalds@vaio linux]$ git bisect bad
  9c521a200bc3c12bd724e48a75c57d5358f672be is the first bad commit
  commit 9c521a200bc3c12bd724e48a75c57d5358f672be
  Author: Stephan Mueller smuel...@chronox.de
  Date:   Thu Apr 9 12:09:55 2015 +0200
 
  crypto: api - remove instance when test failed

Is CONFIG_CRYPTO_MANAGER_DISABLE_TESTS set or unset in you .config?

Cheers,
-- 
Email: Herbert Xu herb...@gondor.apana.org.au
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html