Skip to content

Commit 88f76bc

Browse files
committed
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes from Herbert Xu: "This fixes a number of issues in the chelsio and caam drivers" * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: Revert "crypto: caam/jr - Remove extra memory barrier during job ring dequeue" crypto: caam - fix caam_dump_sg that iterates through scatterlist crypto: caam - fix DKP detection logic MAINTAINERS: Maintainer for Chelsio crypto driver crypto: chelsio - count incomplete block in IV crypto: chelsio - Fix softlockup with heavy I/O crypto: chelsio - Fix NULL pointer dereference
2 parents 89963ad + cbc22b0 commit 88f76bc

File tree

10 files changed

+29
-33
lines changed

10 files changed

+29
-33
lines changed

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4316,7 +4316,7 @@ F: drivers/infiniband/hw/cxgb3/
43164316
F: include/uapi/rdma/cxgb3-abi.h
43174317

43184318
CXGB4 CRYPTO DRIVER (chcr)
4319-
M: Harsh Jain <harsh@chelsio.com>
4319+
M: Atul Gupta <atul.gupta@chelsio.com>
43204320
43214321
W: http://www.chelsio.com
43224322
S: Supported

drivers/crypto/caam/caamalg.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ struct caam_alg_entry {
8989
int class2_alg_type;
9090
bool rfc3686;
9191
bool geniv;
92+
bool nodkp;
9293
};
9394

9495
struct caam_aead_alg {
@@ -2052,6 +2053,7 @@ static struct caam_aead_alg driver_aeads[] = {
20522053
},
20532054
.caam = {
20542055
.class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_GCM,
2056+
.nodkp = true,
20552057
},
20562058
},
20572059
{
@@ -2070,6 +2072,7 @@ static struct caam_aead_alg driver_aeads[] = {
20702072
},
20712073
.caam = {
20722074
.class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_GCM,
2075+
.nodkp = true,
20732076
},
20742077
},
20752078
/* Galois Counter Mode */
@@ -2089,6 +2092,7 @@ static struct caam_aead_alg driver_aeads[] = {
20892092
},
20902093
.caam = {
20912094
.class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_GCM,
2095+
.nodkp = true,
20922096
},
20932097
},
20942098
/* single-pass ipsec_esp descriptor */
@@ -3334,6 +3338,7 @@ static struct caam_aead_alg driver_aeads[] = {
33343338
OP_ALG_AAI_AEAD,
33353339
.class2_alg_type = OP_ALG_ALGSEL_POLY1305 |
33363340
OP_ALG_AAI_AEAD,
3341+
.nodkp = true,
33373342
},
33383343
},
33393344
{
@@ -3356,6 +3361,7 @@ static struct caam_aead_alg driver_aeads[] = {
33563361
OP_ALG_AAI_AEAD,
33573362
.class2_alg_type = OP_ALG_ALGSEL_POLY1305 |
33583363
OP_ALG_AAI_AEAD,
3364+
.nodkp = true,
33593365
},
33603366
},
33613367
};
@@ -3417,8 +3423,7 @@ static int caam_aead_init(struct crypto_aead *tfm)
34173423
container_of(alg, struct caam_aead_alg, aead);
34183424
struct caam_ctx *ctx = crypto_aead_ctx(tfm);
34193425

3420-
return caam_init_common(ctx, &caam_alg->caam,
3421-
alg->setkey == aead_setkey);
3426+
return caam_init_common(ctx, &caam_alg->caam, !caam_alg->caam.nodkp);
34223427
}
34233428

34243429
static void caam_exit_common(struct caam_ctx *ctx)

drivers/crypto/caam/caamalg_qi.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct caam_alg_entry {
3636
int class2_alg_type;
3737
bool rfc3686;
3838
bool geniv;
39+
bool nodkp;
3940
};
4041

4142
struct caam_aead_alg {
@@ -1523,6 +1524,7 @@ static struct caam_aead_alg driver_aeads[] = {
15231524
},
15241525
.caam = {
15251526
.class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_GCM,
1527+
.nodkp = true,
15261528
},
15271529
},
15281530
{
@@ -1541,6 +1543,7 @@ static struct caam_aead_alg driver_aeads[] = {
15411543
},
15421544
.caam = {
15431545
.class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_GCM,
1546+
.nodkp = true,
15441547
},
15451548
},
15461549
/* Galois Counter Mode */
@@ -1560,6 +1563,7 @@ static struct caam_aead_alg driver_aeads[] = {
15601563
},
15611564
.caam = {
15621565
.class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_GCM,
1566+
.nodkp = true,
15631567
}
15641568
},
15651569
/* single-pass ipsec_esp descriptor */
@@ -2433,8 +2437,7 @@ static int caam_aead_init(struct crypto_aead *tfm)
24332437
aead);
24342438
struct caam_ctx *ctx = crypto_aead_ctx(tfm);
24352439

2436-
return caam_init_common(ctx, &caam_alg->caam,
2437-
alg->setkey == aead_setkey);
2440+
return caam_init_common(ctx, &caam_alg->caam, !caam_alg->caam.nodkp);
24382441
}
24392442

24402443
static void caam_exit_common(struct caam_ctx *ctx)

drivers/crypto/caam/caamalg_qi2.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ struct caam_alg_entry {
4242
int class2_alg_type;
4343
bool rfc3686;
4444
bool geniv;
45+
bool nodkp;
4546
};
4647

4748
struct caam_aead_alg {
@@ -1480,7 +1481,7 @@ static int caam_cra_init_aead(struct crypto_aead *tfm)
14801481

14811482
crypto_aead_set_reqsize(tfm, sizeof(struct caam_request));
14821483
return caam_cra_init(crypto_aead_ctx(tfm), &caam_alg->caam,
1483-
alg->setkey == aead_setkey);
1484+
!caam_alg->caam.nodkp);
14841485
}
14851486

14861487
static void caam_exit_common(struct caam_ctx *ctx)
@@ -1641,6 +1642,7 @@ static struct caam_aead_alg driver_aeads[] = {
16411642
},
16421643
.caam = {
16431644
.class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_GCM,
1645+
.nodkp = true,
16441646
},
16451647
},
16461648
{
@@ -1659,6 +1661,7 @@ static struct caam_aead_alg driver_aeads[] = {
16591661
},
16601662
.caam = {
16611663
.class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_GCM,
1664+
.nodkp = true,
16621665
},
16631666
},
16641667
/* Galois Counter Mode */
@@ -1678,6 +1681,7 @@ static struct caam_aead_alg driver_aeads[] = {
16781681
},
16791682
.caam = {
16801683
.class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_GCM,
1684+
.nodkp = true,
16811685
}
16821686
},
16831687
/* single-pass ipsec_esp descriptor */
@@ -2755,6 +2759,7 @@ static struct caam_aead_alg driver_aeads[] = {
27552759
OP_ALG_AAI_AEAD,
27562760
.class2_alg_type = OP_ALG_ALGSEL_POLY1305 |
27572761
OP_ALG_AAI_AEAD,
2762+
.nodkp = true,
27582763
},
27592764
},
27602765
{
@@ -2777,6 +2782,7 @@ static struct caam_aead_alg driver_aeads[] = {
27772782
OP_ALG_AAI_AEAD,
27782783
.class2_alg_type = OP_ALG_ALGSEL_POLY1305 |
27792784
OP_ALG_AAI_AEAD,
2785+
.nodkp = true,
27802786
},
27812787
},
27822788
{

drivers/crypto/caam/error.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void caam_dump_sg(const char *level, const char *prefix_str, int prefix_type,
2222
size_t len;
2323
void *buf;
2424

25-
for (it = sg; it && tlen > 0 ; it = sg_next(sg)) {
25+
for (it = sg; it && tlen > 0 ; it = sg_next(it)) {
2626
/*
2727
* make sure the scatterlist's page
2828
* has a valid virtual memory mapping

drivers/crypto/caam/jr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ static void caam_jr_dequeue(unsigned long devarg)
213213
mb();
214214

215215
/* set done */
216-
wr_reg32_relaxed(&jrp->rregs->outring_rmvd, 1);
216+
wr_reg32(&jrp->rregs->outring_rmvd, 1);
217217

218218
jrp->out_ring_read_index = (jrp->out_ring_read_index + 1) &
219219
(JOBR_DEPTH - 1);

drivers/crypto/caam/regs.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,6 @@ cpu_to_caam(16)
9696
cpu_to_caam(32)
9797
cpu_to_caam(64)
9898

99-
static inline void wr_reg32_relaxed(void __iomem *reg, u32 data)
100-
{
101-
if (caam_little_end)
102-
writel_relaxed(data, reg);
103-
else
104-
writel_relaxed(cpu_to_be32(data), reg);
105-
}
106-
10799
static inline void wr_reg32(void __iomem *reg, u32 data)
108100
{
109101
if (caam_little_end)

drivers/crypto/chelsio/chcr_algo.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -200,17 +200,10 @@ void chcr_verify_tag(struct aead_request *req, u8 *input, int *err)
200200

201201
static int chcr_inc_wrcount(struct chcr_dev *dev)
202202
{
203-
int err = 0;
204-
205-
spin_lock_bh(&dev->lock_chcr_dev);
206203
if (dev->state == CHCR_DETACH)
207-
err = 1;
208-
else
209-
atomic_inc(&dev->inflight);
210-
211-
spin_unlock_bh(&dev->lock_chcr_dev);
212-
213-
return err;
204+
return 1;
205+
atomic_inc(&dev->inflight);
206+
return 0;
214207
}
215208

216209
static inline void chcr_dec_wrcount(struct chcr_dev *dev)
@@ -1101,8 +1094,8 @@ static int chcr_final_cipher_iv(struct ablkcipher_request *req,
11011094
int ret = 0;
11021095

11031096
if (subtype == CRYPTO_ALG_SUB_TYPE_CTR)
1104-
ctr_add_iv(iv, req->info, (reqctx->processed /
1105-
AES_BLOCK_SIZE));
1097+
ctr_add_iv(iv, req->info, DIV_ROUND_UP(reqctx->processed,
1098+
AES_BLOCK_SIZE));
11061099
else if (subtype == CRYPTO_ALG_SUB_TYPE_XTS)
11071100
ret = chcr_update_tweak(req, iv, 1);
11081101
else if (subtype == CRYPTO_ALG_SUB_TYPE_CBC) {

drivers/crypto/chelsio/chcr_core.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,11 @@ static void chcr_detach_device(struct uld_ctx *u_ctx)
243243
{
244244
struct chcr_dev *dev = &u_ctx->dev;
245245

246-
spin_lock_bh(&dev->lock_chcr_dev);
247246
if (dev->state == CHCR_DETACH) {
248-
spin_unlock_bh(&dev->lock_chcr_dev);
249247
pr_debug("Detached Event received for already detach device\n");
250248
return;
251249
}
252250
dev->state = CHCR_DETACH;
253-
spin_unlock_bh(&dev->lock_chcr_dev);
254-
255251
if (atomic_read(&dev->inflight) != 0) {
256252
schedule_delayed_work(&dev->detach_work, WQ_DETACH_TM);
257253
wait_for_completion(&dev->detach_comp);

drivers/crypto/chelsio/chcr_ipsec.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,8 @@ inline void *chcr_crypto_wreq(struct sk_buff *skb,
575575
if (unlikely(credits < ETHTXQ_STOP_THRES)) {
576576
netif_tx_stop_queue(q->txq);
577577
q->q.stops++;
578-
wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F;
578+
if (!q->dbqt)
579+
wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F;
579580
}
580581
wr_mid |= FW_ULPTX_WR_DATA_F;
581582
wr->wreq.flowid_len16 = htonl(wr_mid);

0 commit comments

Comments
 (0)