Skip to content

Commit 035f901

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Merge the crypto tree to pull in fixes for the next merge window.
2 parents bcf741c + 019d62d commit 035f901

11 files changed

Lines changed: 47 additions & 43 deletions

File tree

‎crypto/asymmetric_keys/public_key.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ int public_key_verify_signature(const struct public_key *pkey,
141141
* signature and returns that to us.
142142
*/
143143
ret = crypto_akcipher_verify(req);
144-
if (ret == -EINPROGRESS) {
144+
if ((ret == -EINPROGRESS) || (ret == -EBUSY)) {
145145
wait_for_completion(&compl.completion);
146146
ret = compl.err;
147147
}

‎crypto/drbg.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,9 +1768,8 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg,
17681768
break;
17691769
case -EINPROGRESS:
17701770
case -EBUSY:
1771-
ret = wait_for_completion_interruptible(
1772-
&drbg->ctr_completion);
1773-
if (!ret && !drbg->ctr_async_err) {
1771+
wait_for_completion(&drbg->ctr_completion);
1772+
if (!drbg->ctr_async_err) {
17741773
reinit_completion(&drbg->ctr_completion);
17751774
break;
17761775
}

‎crypto/gcm.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,8 @@ static int crypto_gcm_setkey(struct crypto_aead *aead, const u8 *key,
152152

153153
err = crypto_skcipher_encrypt(&data->req);
154154
if (err == -EINPROGRESS || err == -EBUSY) {
155-
err = wait_for_completion_interruptible(
156-
&data->result.completion);
157-
if (!err)
158-
err = data->result.err;
155+
wait_for_completion(&data->result.completion);
156+
err = data->result.err;
159157
}
160158

161159
if (err)

‎drivers/crypto/caam/caamalg.c‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,8 +1187,8 @@ static struct aead_edesc *aead_edesc_alloc(struct aead_request *req,
11871187
struct crypto_aead *aead = crypto_aead_reqtfm(req);
11881188
struct caam_ctx *ctx = crypto_aead_ctx(aead);
11891189
struct device *jrdev = ctx->jrdev;
1190-
gfp_t flags = (req->base.flags & (CRYPTO_TFM_REQ_MAY_BACKLOG |
1191-
CRYPTO_TFM_REQ_MAY_SLEEP)) ? GFP_KERNEL : GFP_ATOMIC;
1190+
gfp_t flags = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
1191+
GFP_KERNEL : GFP_ATOMIC;
11921192
int src_nents, mapped_src_nents, dst_nents = 0, mapped_dst_nents = 0;
11931193
struct aead_edesc *edesc;
11941194
int sec4_sg_index, sec4_sg_len, sec4_sg_bytes;
@@ -1475,8 +1475,7 @@ static struct ablkcipher_edesc *ablkcipher_edesc_alloc(struct ablkcipher_request
14751475
struct crypto_ablkcipher *ablkcipher = crypto_ablkcipher_reqtfm(req);
14761476
struct caam_ctx *ctx = crypto_ablkcipher_ctx(ablkcipher);
14771477
struct device *jrdev = ctx->jrdev;
1478-
gfp_t flags = (req->base.flags & (CRYPTO_TFM_REQ_MAY_BACKLOG |
1479-
CRYPTO_TFM_REQ_MAY_SLEEP)) ?
1478+
gfp_t flags = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
14801479
GFP_KERNEL : GFP_ATOMIC;
14811480
int src_nents, mapped_src_nents, dst_nents = 0, mapped_dst_nents = 0;
14821481
struct ablkcipher_edesc *edesc;
@@ -1681,8 +1680,7 @@ static struct ablkcipher_edesc *ablkcipher_giv_edesc_alloc(
16811680
struct crypto_ablkcipher *ablkcipher = crypto_ablkcipher_reqtfm(req);
16821681
struct caam_ctx *ctx = crypto_ablkcipher_ctx(ablkcipher);
16831682
struct device *jrdev = ctx->jrdev;
1684-
gfp_t flags = (req->base.flags & (CRYPTO_TFM_REQ_MAY_BACKLOG |
1685-
CRYPTO_TFM_REQ_MAY_SLEEP)) ?
1683+
gfp_t flags = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
16861684
GFP_KERNEL : GFP_ATOMIC;
16871685
int src_nents, mapped_src_nents, dst_nents, mapped_dst_nents;
16881686
struct ablkcipher_edesc *edesc;

‎drivers/crypto/caam/caamalg_qi.c‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,8 @@ static struct aead_edesc *aead_edesc_alloc(struct aead_request *req,
555555
struct caam_aead_alg *alg = container_of(crypto_aead_alg(aead),
556556
typeof(*alg), aead);
557557
struct device *qidev = ctx->qidev;
558-
gfp_t flags = (req->base.flags & (CRYPTO_TFM_REQ_MAY_BACKLOG |
559-
CRYPTO_TFM_REQ_MAY_SLEEP)) ? GFP_KERNEL : GFP_ATOMIC;
558+
gfp_t flags = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
559+
GFP_KERNEL : GFP_ATOMIC;
560560
int src_nents, mapped_src_nents, dst_nents = 0, mapped_dst_nents = 0;
561561
struct aead_edesc *edesc;
562562
dma_addr_t qm_sg_dma, iv_dma = 0;
@@ -808,8 +808,7 @@ static struct ablkcipher_edesc *ablkcipher_edesc_alloc(struct ablkcipher_request
808808
struct crypto_ablkcipher *ablkcipher = crypto_ablkcipher_reqtfm(req);
809809
struct caam_ctx *ctx = crypto_ablkcipher_ctx(ablkcipher);
810810
struct device *qidev = ctx->qidev;
811-
gfp_t flags = (req->base.flags & (CRYPTO_TFM_REQ_MAY_BACKLOG |
812-
CRYPTO_TFM_REQ_MAY_SLEEP)) ?
811+
gfp_t flags = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
813812
GFP_KERNEL : GFP_ATOMIC;
814813
int src_nents, mapped_src_nents, dst_nents = 0, mapped_dst_nents = 0;
815814
struct ablkcipher_edesc *edesc;
@@ -953,8 +952,7 @@ static struct ablkcipher_edesc *ablkcipher_giv_edesc_alloc(
953952
struct crypto_ablkcipher *ablkcipher = crypto_ablkcipher_reqtfm(req);
954953
struct caam_ctx *ctx = crypto_ablkcipher_ctx(ablkcipher);
955954
struct device *qidev = ctx->qidev;
956-
gfp_t flags = (req->base.flags & (CRYPTO_TFM_REQ_MAY_BACKLOG |
957-
CRYPTO_TFM_REQ_MAY_SLEEP)) ?
955+
gfp_t flags = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
958956
GFP_KERNEL : GFP_ATOMIC;
959957
int src_nents, mapped_src_nents, dst_nents, mapped_dst_nents;
960958
struct ablkcipher_edesc *edesc;

‎drivers/crypto/caam/caamhash.c‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -719,8 +719,8 @@ static int ahash_update_ctx(struct ahash_request *req)
719719
struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash);
720720
struct caam_hash_state *state = ahash_request_ctx(req);
721721
struct device *jrdev = ctx->jrdev;
722-
gfp_t flags = (req->base.flags & (CRYPTO_TFM_REQ_MAY_BACKLOG |
723-
CRYPTO_TFM_REQ_MAY_SLEEP)) ? GFP_KERNEL : GFP_ATOMIC;
722+
gfp_t flags = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
723+
GFP_KERNEL : GFP_ATOMIC;
724724
u8 *buf = current_buf(state);
725725
int *buflen = current_buflen(state);
726726
u8 *next_buf = alt_buf(state);
@@ -849,8 +849,8 @@ static int ahash_final_ctx(struct ahash_request *req)
849849
struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash);
850850
struct caam_hash_state *state = ahash_request_ctx(req);
851851
struct device *jrdev = ctx->jrdev;
852-
gfp_t flags = (req->base.flags & (CRYPTO_TFM_REQ_MAY_BACKLOG |
853-
CRYPTO_TFM_REQ_MAY_SLEEP)) ? GFP_KERNEL : GFP_ATOMIC;
852+
gfp_t flags = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
853+
GFP_KERNEL : GFP_ATOMIC;
854854
int buflen = *current_buflen(state);
855855
u32 *desc;
856856
int sec4_sg_bytes, sec4_sg_src_index;
@@ -926,8 +926,8 @@ static int ahash_finup_ctx(struct ahash_request *req)
926926
struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash);
927927
struct caam_hash_state *state = ahash_request_ctx(req);
928928
struct device *jrdev = ctx->jrdev;
929-
gfp_t flags = (req->base.flags & (CRYPTO_TFM_REQ_MAY_BACKLOG |
930-
CRYPTO_TFM_REQ_MAY_SLEEP)) ? GFP_KERNEL : GFP_ATOMIC;
929+
gfp_t flags = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
930+
GFP_KERNEL : GFP_ATOMIC;
931931
int buflen = *current_buflen(state);
932932
u32 *desc;
933933
int sec4_sg_src_index;
@@ -1013,8 +1013,8 @@ static int ahash_digest(struct ahash_request *req)
10131013
struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash);
10141014
struct caam_hash_state *state = ahash_request_ctx(req);
10151015
struct device *jrdev = ctx->jrdev;
1016-
gfp_t flags = (req->base.flags & (CRYPTO_TFM_REQ_MAY_BACKLOG |
1017-
CRYPTO_TFM_REQ_MAY_SLEEP)) ? GFP_KERNEL : GFP_ATOMIC;
1016+
gfp_t flags = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
1017+
GFP_KERNEL : GFP_ATOMIC;
10181018
u32 *desc;
10191019
int digestsize = crypto_ahash_digestsize(ahash);
10201020
int src_nents, mapped_nents;
@@ -1093,8 +1093,8 @@ static int ahash_final_no_ctx(struct ahash_request *req)
10931093
struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash);
10941094
struct caam_hash_state *state = ahash_request_ctx(req);
10951095
struct device *jrdev = ctx->jrdev;
1096-
gfp_t flags = (req->base.flags & (CRYPTO_TFM_REQ_MAY_BACKLOG |
1097-
CRYPTO_TFM_REQ_MAY_SLEEP)) ? GFP_KERNEL : GFP_ATOMIC;
1096+
gfp_t flags = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
1097+
GFP_KERNEL : GFP_ATOMIC;
10981098
u8 *buf = current_buf(state);
10991099
int buflen = *current_buflen(state);
11001100
u32 *desc;
@@ -1154,8 +1154,8 @@ static int ahash_update_no_ctx(struct ahash_request *req)
11541154
struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash);
11551155
struct caam_hash_state *state = ahash_request_ctx(req);
11561156
struct device *jrdev = ctx->jrdev;
1157-
gfp_t flags = (req->base.flags & (CRYPTO_TFM_REQ_MAY_BACKLOG |
1158-
CRYPTO_TFM_REQ_MAY_SLEEP)) ? GFP_KERNEL : GFP_ATOMIC;
1157+
gfp_t flags = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
1158+
GFP_KERNEL : GFP_ATOMIC;
11591159
u8 *buf = current_buf(state);
11601160
int *buflen = current_buflen(state);
11611161
u8 *next_buf = alt_buf(state);
@@ -1280,8 +1280,8 @@ static int ahash_finup_no_ctx(struct ahash_request *req)
12801280
struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash);
12811281
struct caam_hash_state *state = ahash_request_ctx(req);
12821282
struct device *jrdev = ctx->jrdev;
1283-
gfp_t flags = (req->base.flags & (CRYPTO_TFM_REQ_MAY_BACKLOG |
1284-
CRYPTO_TFM_REQ_MAY_SLEEP)) ? GFP_KERNEL : GFP_ATOMIC;
1283+
gfp_t flags = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
1284+
GFP_KERNEL : GFP_ATOMIC;
12851285
int buflen = *current_buflen(state);
12861286
u32 *desc;
12871287
int sec4_sg_bytes, sec4_sg_src_index, src_nents, mapped_nents;
@@ -1370,8 +1370,8 @@ static int ahash_update_first(struct ahash_request *req)
13701370
struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash);
13711371
struct caam_hash_state *state = ahash_request_ctx(req);
13721372
struct device *jrdev = ctx->jrdev;
1373-
gfp_t flags = (req->base.flags & (CRYPTO_TFM_REQ_MAY_BACKLOG |
1374-
CRYPTO_TFM_REQ_MAY_SLEEP)) ? GFP_KERNEL : GFP_ATOMIC;
1373+
gfp_t flags = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
1374+
GFP_KERNEL : GFP_ATOMIC;
13751375
u8 *next_buf = alt_buf(state);
13761376
int *next_buflen = alt_buflen(state);
13771377
int to_hash;

‎drivers/crypto/caam/caampkc.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ static struct rsa_edesc *rsa_edesc_alloc(struct akcipher_request *req,
173173
struct caam_rsa_ctx *ctx = akcipher_tfm_ctx(tfm);
174174
struct device *dev = ctx->dev;
175175
struct rsa_edesc *edesc;
176-
gfp_t flags = (req->base.flags & (CRYPTO_TFM_REQ_MAY_BACKLOG |
177-
CRYPTO_TFM_REQ_MAY_SLEEP)) ? GFP_KERNEL : GFP_ATOMIC;
176+
gfp_t flags = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
177+
GFP_KERNEL : GFP_ATOMIC;
178178
int sgc;
179179
int sec4_sg_index, sec4_sg_len = 0, sec4_sg_bytes;
180180
int src_nents, dst_nents;

‎drivers/infiniband/sw/rxe/rxe.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
static inline u32 rxe_crc32(struct rxe_dev *rxe,
6969
u32 crc, void *next, size_t len)
7070
{
71+
u32 retval;
7172
int err;
7273

7374
SHASH_DESC_ON_STACK(shash, rxe->tfm);
@@ -81,7 +82,9 @@ static inline u32 rxe_crc32(struct rxe_dev *rxe,
8182
return crc32_le(crc, next, len);
8283
}
8384

84-
return *(u32 *)shash_desc_ctx(shash);
85+
retval = *(u32 *)shash_desc_ctx(shash);
86+
barrier_data(shash_desc_ctx(shash));
87+
return retval;
8588
}
8689

8790
int rxe_set_mtu(struct rxe_dev *rxe, unsigned int dev_mtu);

‎fs/btrfs/hash.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ u32 btrfs_crc32c(u32 crc, const void *address, unsigned int length)
3838
{
3939
SHASH_DESC_ON_STACK(shash, tfm);
4040
u32 *ctx = (u32 *)shash_desc_ctx(shash);
41+
u32 retval;
4142
int err;
4243

4344
shash->tfm = tfm;
@@ -47,5 +48,7 @@ u32 btrfs_crc32c(u32 crc, const void *address, unsigned int length)
4748
err = crypto_shash_update(shash, address, length);
4849
BUG_ON(err);
4950

50-
return *ctx;
51+
retval = *ctx;
52+
barrier_data(ctx);
53+
return retval;
5154
}

‎fs/f2fs/f2fs.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,7 @@ static inline u32 f2fs_crc32(struct f2fs_sb_info *sbi, const void *address,
10781078
{
10791079
SHASH_DESC_ON_STACK(shash, sbi->s_chksum_driver);
10801080
u32 *ctx = (u32 *)shash_desc_ctx(shash);
1081+
u32 retval;
10811082
int err;
10821083

10831084
shash->tfm = sbi->s_chksum_driver;
@@ -1087,7 +1088,9 @@ static inline u32 f2fs_crc32(struct f2fs_sb_info *sbi, const void *address,
10871088
err = crypto_shash_update(shash, address, length);
10881089
BUG_ON(err);
10891090

1090-
return *ctx;
1091+
retval = *ctx;
1092+
barrier_data(ctx);
1093+
return retval;
10911094
}
10921095

10931096
static inline bool f2fs_crc_valid(struct f2fs_sb_info *sbi, __u32 blk_crc,

0 commit comments

Comments
 (0)