Skip to content

Commit 75f2222

Browse files
ebiggersherbertx
authored andcommitted
crypto: nx - don't abuse shash MAY_SLEEP flag
The nx driver uses the MAY_SLEEP flag in shash_desc::flags as an indicator to not retry sending the operation to the hardware as many times before returning -EBUSY. This is bogus because (1) that's not what the MAY_SLEEP flag is for, and (2) the shash API doesn't allow failing if the hardware is busy anyway. For now, just make it always retry the larger number of times. This doesn't actually fix this driver, but it at least makes it not use the shash_desc::flags field anymore. Then this field can be removed, as no other drivers use it. Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 54fe792 commit 75f2222

3 files changed

Lines changed: 8 additions & 16 deletions

File tree

drivers/crypto/nx/nx-aes-xcbc.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ static int nx_xcbc_empty(struct shash_desc *desc, u8 *out)
105105
nx_ctx->op.inlen = (nx_ctx->in_sg - in_sg) * sizeof(struct nx_sg);
106106
nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg);
107107

108-
rc = nx_hcall_sync(nx_ctx, &nx_ctx->op,
109-
desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP);
108+
rc = nx_hcall_sync(nx_ctx, &nx_ctx->op, 0);
110109
if (rc)
111110
goto out;
112111
atomic_inc(&(nx_ctx->stats->aes_ops));
@@ -134,8 +133,7 @@ static int nx_xcbc_empty(struct shash_desc *desc, u8 *out)
134133
nx_ctx->op.inlen = (nx_ctx->in_sg - in_sg) * sizeof(struct nx_sg);
135134
nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg);
136135

137-
rc = nx_hcall_sync(nx_ctx, &nx_ctx->op,
138-
desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP);
136+
rc = nx_hcall_sync(nx_ctx, &nx_ctx->op, 0);
139137
if (rc)
140138
goto out;
141139
atomic_inc(&(nx_ctx->stats->aes_ops));
@@ -279,8 +277,7 @@ static int nx_xcbc_update(struct shash_desc *desc,
279277
goto out;
280278
}
281279

282-
rc = nx_hcall_sync(nx_ctx, &nx_ctx->op,
283-
desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP);
280+
rc = nx_hcall_sync(nx_ctx, &nx_ctx->op, 0);
284281
if (rc)
285282
goto out;
286283

@@ -361,8 +358,7 @@ static int nx_xcbc_final(struct shash_desc *desc, u8 *out)
361358
goto out;
362359
}
363360

364-
rc = nx_hcall_sync(nx_ctx, &nx_ctx->op,
365-
desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP);
361+
rc = nx_hcall_sync(nx_ctx, &nx_ctx->op, 0);
366362
if (rc)
367363
goto out;
368364

drivers/crypto/nx/nx-sha256.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ static int nx_sha256_update(struct shash_desc *desc, const u8 *data,
162162
goto out;
163163
}
164164

165-
rc = nx_hcall_sync(nx_ctx, &nx_ctx->op,
166-
desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP);
165+
rc = nx_hcall_sync(nx_ctx, &nx_ctx->op, 0);
167166
if (rc)
168167
goto out;
169168

@@ -243,8 +242,7 @@ static int nx_sha256_final(struct shash_desc *desc, u8 *out)
243242
goto out;
244243
}
245244

246-
rc = nx_hcall_sync(nx_ctx, &nx_ctx->op,
247-
desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP);
245+
rc = nx_hcall_sync(nx_ctx, &nx_ctx->op, 0);
248246
if (rc)
249247
goto out;
250248

drivers/crypto/nx/nx-sha512.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,7 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data,
166166
goto out;
167167
}
168168

169-
rc = nx_hcall_sync(nx_ctx, &nx_ctx->op,
170-
desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP);
169+
rc = nx_hcall_sync(nx_ctx, &nx_ctx->op, 0);
171170
if (rc)
172171
goto out;
173172

@@ -249,8 +248,7 @@ static int nx_sha512_final(struct shash_desc *desc, u8 *out)
249248
goto out;
250249
}
251250

252-
rc = nx_hcall_sync(nx_ctx, &nx_ctx->op,
253-
desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP);
251+
rc = nx_hcall_sync(nx_ctx, &nx_ctx->op, 0);
254252
if (rc)
255253
goto out;
256254

0 commit comments

Comments
 (0)