diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2005-09-01 20:43:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-09-01 20:43:05 -0400 |
commit | 64baf3cfea974d2b9e671ccfdbc03e030ea5ebc6 (patch) | |
tree | 2bae23bf3d7378ba2d60be8aee6b0178d1d9c721 /crypto/internal.h | |
parent | fb4f10ed50f01b0f953068456bfb6e2885921b01 (diff) |
[CRYPTO]: Added CRYPTO_TFM_REQ_MAY_SLEEP flag
The crypto layer currently uses in_atomic() to determine whether it is
allowed to sleep. This is incorrect since spin locks don't always cause
in_atomic() to return true.
Instead of that, this patch returns to an earlier idea of a per-tfm flag
which determines whether sleeping is allowed. Unlike the earlier version,
the default is to not allow sleeping. This ensures that no existing code
can break.
As usual, this flag may either be set through crypto_alloc_tfm(), or
just before a specific crypto operation.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'crypto/internal.h')
-rw-r--r-- | crypto/internal.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/internal.h b/crypto/internal.h index 37515beafc8c..37aa652ce5ce 100644 --- a/crypto/internal.h +++ b/crypto/internal.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
20 | #include <linux/slab.h> | ||
20 | #include <asm/kmap_types.h> | 21 | #include <asm/kmap_types.h> |
21 | 22 | ||
22 | extern enum km_type crypto_km_types[]; | 23 | extern enum km_type crypto_km_types[]; |
@@ -38,7 +39,7 @@ static inline void crypto_kunmap(void *vaddr, int out) | |||
38 | 39 | ||
39 | static inline void crypto_yield(struct crypto_tfm *tfm) | 40 | static inline void crypto_yield(struct crypto_tfm *tfm) |
40 | { | 41 | { |
41 | if (!in_atomic()) | 42 | if (tfm->crt_flags & CRYPTO_TFM_REQ_MAY_SLEEP) |
42 | cond_resched(); | 43 | cond_resched(); |
43 | } | 44 | } |
44 | 45 | ||