2013-11-28 18:20:18

by Mathias Krause

[permalink] [raw]
Subject: [PATCH 0/2] pcrypt/padata rcu fixes

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


2013-11-28 18:20:19

by Mathias Krause

[permalink] [raw]
Subject: [PATCH 2/2] padata: Fix wrong usage of rcu_dereference()

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 <[email protected]>
Cc: Steffen Klassert <[email protected]>
---
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

2013-11-28 18:20:19

by Mathias Krause

[permalink] [raw]
Subject: [PATCH 1/2] crypto: pcrypt - Fix wrong usage of rcu_dereference()

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 <[email protected]>
Cc: Steffen Klassert <[email protected]>
Cc: Herbert Xu <[email protected]>
Cc: "David S. Miller" <[email protected]>
---
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

2013-12-02 12:12:42

by Steffen Klassert

[permalink] [raw]
Subject: Re: [PATCH 0/2] pcrypt/padata rcu fixes

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 <[email protected]>

Thanks!

2013-12-05 14:36:24

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH 0/2] pcrypt/padata rcu fixes

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 <[email protected]>

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