Skip to content

Commit 1d6669f

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Merge the crypto tree to pull in the qat registration bug fix.
2 parents 76bea64 + 17fb874 commit 1d6669f

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

drivers/char/hw_random/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ static int hwrng_fillfn(void *unused)
429429
static void start_khwrngd(void)
430430
{
431431
hwrng_fill = kthread_run(hwrng_fillfn, NULL, "hwrng");
432-
if (hwrng_fill == ERR_PTR(-ENOMEM)) {
432+
if (IS_ERR(hwrng_fill)) {
433433
pr_err("hwrng_fill thread creation failed");
434434
hwrng_fill = NULL;
435435
}

drivers/crypto/ixp4xx_crypto.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,6 @@ static int ablk_perform(struct ablkcipher_request *req, int encrypt)
905905
crypt->mode |= NPE_OP_NOT_IN_PLACE;
906906
/* This was never tested by Intel
907907
* for more than one dst buffer, I think. */
908-
BUG_ON(req->dst->length < nbytes);
909908
req_ctx->dst = NULL;
910909
if (!chainup_buffers(dev, req->dst, nbytes, &dst_hook,
911910
flags, DMA_FROM_DEVICE))

drivers/crypto/qat/qat_common/qat_algs.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@
7373
ICP_QAT_HW_CIPHER_KEY_CONVERT, \
7474
ICP_QAT_HW_CIPHER_DECRYPT)
7575

76-
static atomic_t active_dev;
76+
static DEFINE_MUTEX(algs_lock);
77+
static unsigned int active_devs;
7778

7879
struct qat_alg_buf {
7980
uint32_t len;
@@ -1275,7 +1276,10 @@ static struct crypto_alg qat_algs[] = { {
12751276

12761277
int qat_algs_register(void)
12771278
{
1278-
if (atomic_add_return(1, &active_dev) == 1) {
1279+
int ret = 0;
1280+
1281+
mutex_lock(&algs_lock);
1282+
if (++active_devs == 1) {
12791283
int i;
12801284

12811285
for (i = 0; i < ARRAY_SIZE(qat_algs); i++)
@@ -1284,21 +1288,25 @@ int qat_algs_register(void)
12841288
CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC :
12851289
CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC;
12861290

1287-
return crypto_register_algs(qat_algs, ARRAY_SIZE(qat_algs));
1291+
ret = crypto_register_algs(qat_algs, ARRAY_SIZE(qat_algs));
12881292
}
1289-
return 0;
1293+
mutex_unlock(&algs_lock);
1294+
return ret;
12901295
}
12911296

12921297
int qat_algs_unregister(void)
12931298
{
1294-
if (atomic_sub_return(1, &active_dev) == 0)
1295-
return crypto_unregister_algs(qat_algs, ARRAY_SIZE(qat_algs));
1296-
return 0;
1299+
int ret = 0;
1300+
1301+
mutex_lock(&algs_lock);
1302+
if (--active_devs == 0)
1303+
ret = crypto_unregister_algs(qat_algs, ARRAY_SIZE(qat_algs));
1304+
mutex_unlock(&algs_lock);
1305+
return ret;
12971306
}
12981307

12991308
int qat_algs_init(void)
13001309
{
1301-
atomic_set(&active_dev, 0);
13021310
crypto_get_default_rng();
13031311
return 0;
13041312
}

0 commit comments

Comments
 (0)