Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH 0/2] pcrypt/padata rcu fixes
@ 2013-11-28 18:20 Mathias Krause
  2013-11-28 18:20 ` [PATCH 1/2] crypto: pcrypt - Fix wrong usage of rcu_dereference() Mathias Krause
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mathias Krause @ 2013-11-28 18:20 UTC (permalink / raw)
  To: Steffen Klassert, Herbert Xu
  Cc: David S. Miller, linux-crypto, Mathias Krause

Two small RCU related fixes, lockdep complained about.

Please apply!


Mathias Krause (2):
  crypto: pcrypt - Fix wrong usage of rcu_dereference()
  padata: Fix wrong usage of rcu_dereference()

 crypto/pcrypt.c |    2 +-
 kernel/padata.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] crypto: pcrypt - Fix wrong usage of rcu_dereference()
  2013-11-28 18:20 [PATCH 0/2] pcrypt/padata rcu fixes Mathias Krause
@ 2013-11-28 18:20 ` Mathias Krause
  2013-11-28 18:20 ` [PATCH 2/2] padata: " Mathias Krause
  2013-12-02 12:12 ` [PATCH 0/2] pcrypt/padata rcu fixes Steffen Klassert
  2 siblings, 0 replies; 5+ messages in thread
From: Mathias Krause @ 2013-11-28 18:20 UTC (permalink / raw)
  To: Steffen Klassert, Herbert Xu
  Cc: David S. Miller, linux-crypto, Mathias Krause

A kernel with enabled lockdep complains about the wrong usage of
rcu_dereference() under a rcu_read_lock_bh() protected region.

  ===============================
  [ INFO: suspicious RCU usage. ]
  3.13.0-rc1+ #126 Not tainted
  -------------------------------
  linux/crypto/pcrypt.c:81 suspicious rcu_dereference_check() usage!

  other info that might help us debug this:

  rcu_scheduler_active = 1, debug_locks = 1
  1 lock held by cryptomgr_test/153:
   #0:  (rcu_read_lock_bh){.+....}, at: [<ffffffff812c8075>] pcrypt_do_parallel.isra.2+0x5/0x200

Fix that by using rcu_dereference_bh() instead.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
---
 crypto/pcrypt.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c
index f8c920cafe..309d345ead 100644
--- a/crypto/pcrypt.c
+++ b/crypto/pcrypt.c
@@ -78,7 +78,7 @@ static int pcrypt_do_parallel(struct padata_priv *padata, unsigned int *cb_cpu,
 	cpu = *cb_cpu;
 
 	rcu_read_lock_bh();
-	cpumask = rcu_dereference(pcrypt->cb_cpumask);
+	cpumask = rcu_dereference_bh(pcrypt->cb_cpumask);
 	if (cpumask_test_cpu(cpu, cpumask->mask))
 			goto out;
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] padata: Fix wrong usage of rcu_dereference()
  2013-11-28 18:20 [PATCH 0/2] pcrypt/padata rcu fixes Mathias Krause
  2013-11-28 18:20 ` [PATCH 1/2] crypto: pcrypt - Fix wrong usage of rcu_dereference() Mathias Krause
@ 2013-11-28 18:20 ` Mathias Krause
  2013-12-02 12:12 ` [PATCH 0/2] pcrypt/padata rcu fixes Steffen Klassert
  2 siblings, 0 replies; 5+ messages in thread
From: Mathias Krause @ 2013-11-28 18:20 UTC (permalink / raw)
  To: Steffen Klassert, Herbert Xu
  Cc: David S. Miller, linux-crypto, Mathias Krause

A kernel with enabled lockdep complains about the wrong usage of
rcu_dereference() under a rcu_read_lock_bh() protected region.

  ===============================
  [ INFO: suspicious RCU usage. ]
  3.13.0-rc1+ #126 Not tainted
  -------------------------------
  linux/kernel/padata.c:115 suspicious rcu_dereference_check() usage!

  other info that might help us debug this:

  rcu_scheduler_active = 1, debug_locks = 1
  1 lock held by cryptomgr_test/153:
   #0:  (rcu_read_lock_bh){.+....}, at: [<ffffffff8115c235>] padata_do_parallel+0x5/0x270

Fix that by using rcu_dereference_bh() instead.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
---
 kernel/padata.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/padata.c b/kernel/padata.c
index 2abd25d79c..161402f0b5 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -112,7 +112,7 @@ int padata_do_parallel(struct padata_instance *pinst,
 
 	rcu_read_lock_bh();
 
-	pd = rcu_dereference(pinst->pd);
+	pd = rcu_dereference_bh(pinst->pd);
 
 	err = -EINVAL;
 	if (!(pinst->flags & PADATA_INIT) || pinst->flags & PADATA_INVALID)
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] pcrypt/padata rcu fixes
  2013-11-28 18:20 [PATCH 0/2] pcrypt/padata rcu fixes Mathias Krause
  2013-11-28 18:20 ` [PATCH 1/2] crypto: pcrypt - Fix wrong usage of rcu_dereference() Mathias Krause
  2013-11-28 18:20 ` [PATCH 2/2] padata: " Mathias Krause
@ 2013-12-02 12:12 ` Steffen Klassert
  2013-12-05 14:36   ` Herbert Xu
  2 siblings, 1 reply; 5+ messages in thread
From: Steffen Klassert @ 2013-12-02 12:12 UTC (permalink / raw)
  To: Mathias Krause; +Cc: Herbert Xu, David S. Miller, linux-crypto

On Thu, Nov 28, 2013 at 07:20:03PM +0100, Mathias Krause wrote:
> Two small RCU related fixes, lockdep complained about.
> 
> Please apply!
> 
> 
> Mathias Krause (2):
>   crypto: pcrypt - Fix wrong usage of rcu_dereference()
>   padata: Fix wrong usage of rcu_dereference()
> 

Both
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>

Thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] pcrypt/padata rcu fixes
  2013-12-02 12:12 ` [PATCH 0/2] pcrypt/padata rcu fixes Steffen Klassert
@ 2013-12-05 14:36   ` Herbert Xu
  0 siblings, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2013-12-05 14:36 UTC (permalink / raw)
  To: Steffen Klassert; +Cc: Mathias Krause, David S. Miller, linux-crypto

On Mon, Dec 02, 2013 at 01:12:33PM +0100, Steffen Klassert wrote:
> On Thu, Nov 28, 2013 at 07:20:03PM +0100, Mathias Krause wrote:
> > Two small RCU related fixes, lockdep complained about.
> > 
> > Please apply!
> > 
> > 
> > Mathias Krause (2):
> >   crypto: pcrypt - Fix wrong usage of rcu_dereference()
> >   padata: Fix wrong usage of rcu_dereference()
> > 
> 
> Both
> Acked-by: Steffen Klassert <steffen.klassert@secunet.com>

Both patches applied.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-12-05 14:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-28 18:20 [PATCH 0/2] pcrypt/padata rcu fixes Mathias Krause
2013-11-28 18:20 ` [PATCH 1/2] crypto: pcrypt - Fix wrong usage of rcu_dereference() Mathias Krause
2013-11-28 18:20 ` [PATCH 2/2] padata: " Mathias Krause
2013-12-02 12:12 ` [PATCH 0/2] pcrypt/padata rcu fixes Steffen Klassert
2013-12-05 14:36   ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox