Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'v6.15-p4' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6

Pull crypto fixes from Herbert Xu:

- Disable ahash request chaining as it causes problems with the sa2ul
driver

- Fix a couple of bugs in the new scomp stream freeing code

- Fix an old caam refcount underflow that is possibly showing up now
because of the new parallel self-tests

- Fix regression in the tegra driver

* tag 'v6.15-p4' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
crypto: ahash - Disable request chaining
crypto: scomp - Fix wild memory accesses in scomp_free_streams
crypto: caam/qi - Fix drv_ctx refcount bug
crypto: scomp - Fix null-pointer deref when freeing streams
crypto: tegra - Fix IV usage for AES ECB

+18 -87
+1 -75
crypto/ahash.c
··· 315 315 316 316 static bool ahash_request_hasvirt(struct ahash_request *req) 317 317 { 318 - struct ahash_request *r2; 319 - 320 - if (ahash_request_isvirt(req)) 321 - return true; 322 - 323 - list_for_each_entry(r2, &req->base.list, base.list) 324 - if (ahash_request_isvirt(r2)) 325 - return true; 326 - 327 - return false; 318 + return ahash_request_isvirt(req); 328 319 } 329 320 330 321 static int ahash_reqchain_virt(struct ahash_save_req_state *state, ··· 463 472 bool update = op == crypto_ahash_alg(tfm)->update; 464 473 struct ahash_save_req_state *state; 465 474 struct ahash_save_req_state state0; 466 - struct ahash_request *r2; 467 475 u8 *page = NULL; 468 476 int err; 469 477 ··· 499 509 state->offset = 0; 500 510 state->nbytes = 0; 501 511 INIT_LIST_HEAD(&state->head); 502 - list_splice_init(&req->base.list, &state->head); 503 512 504 513 if (page) 505 514 sg_init_one(&state->sg, page, PAGE_SIZE); ··· 529 540 530 541 out_set_chain: 531 542 req->base.err = err; 532 - list_for_each_entry(r2, &req->base.list, base.list) 533 - r2->base.err = err; 534 - 535 543 return err; 536 544 } 537 545 ··· 537 551 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); 538 552 539 553 if (likely(tfm->using_shash)) { 540 - struct ahash_request *r2; 541 554 int err; 542 555 543 556 err = crypto_shash_init(prepare_shash_desc(req, tfm)); 544 557 req->base.err = err; 545 - 546 - list_for_each_entry(r2, &req->base.list, base.list) { 547 - struct shash_desc *desc; 548 - 549 - desc = prepare_shash_desc(r2, tfm); 550 - r2->base.err = crypto_shash_init(desc); 551 - } 552 - 553 558 return err; 554 559 } 555 560 ··· 597 620 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); 598 621 599 622 if (likely(tfm->using_shash)) { 600 - struct ahash_request *r2; 601 623 int err; 602 624 603 625 err = shash_ahash_update(req, ahash_request_ctx(req)); 604 626 req->base.err = err; 605 - 606 - list_for_each_entry(r2, &req->base.list, base.list) { 607 - struct shash_desc *desc; 608 - 609 - desc = ahash_request_ctx(r2); 610 - r2->base.err = shash_ahash_update(r2, desc); 611 - } 612 - 613 627 return err; 614 628 } 615 629 ··· 613 645 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); 614 646 615 647 if (likely(tfm->using_shash)) { 616 - struct ahash_request *r2; 617 648 int err; 618 649 619 650 err = crypto_shash_final(ahash_request_ctx(req), req->result); 620 651 req->base.err = err; 621 - 622 - list_for_each_entry(r2, &req->base.list, base.list) { 623 - struct shash_desc *desc; 624 - 625 - desc = ahash_request_ctx(r2); 626 - r2->base.err = crypto_shash_final(desc, r2->result); 627 - } 628 - 629 652 return err; 630 653 } 631 654 ··· 629 670 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); 630 671 631 672 if (likely(tfm->using_shash)) { 632 - struct ahash_request *r2; 633 673 int err; 634 674 635 675 err = shash_ahash_finup(req, ahash_request_ctx(req)); 636 676 req->base.err = err; 637 - 638 - list_for_each_entry(r2, &req->base.list, base.list) { 639 - struct shash_desc *desc; 640 - 641 - desc = ahash_request_ctx(r2); 642 - r2->base.err = shash_ahash_finup(r2, desc); 643 - } 644 - 645 677 return err; 646 678 } 647 679 ··· 707 757 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); 708 758 709 759 if (likely(tfm->using_shash)) { 710 - struct ahash_request *r2; 711 760 int err; 712 761 713 762 err = shash_ahash_digest(req, prepare_shash_desc(req, tfm)); 714 763 req->base.err = err; 715 - 716 - list_for_each_entry(r2, &req->base.list, base.list) { 717 - struct shash_desc *desc; 718 - 719 - desc = prepare_shash_desc(r2, tfm); 720 - r2->base.err = shash_ahash_digest(r2, desc); 721 - } 722 - 723 764 return err; 724 765 } 725 766 ··· 1073 1132 return crypto_register_instance(tmpl, ahash_crypto_instance(inst)); 1074 1133 } 1075 1134 EXPORT_SYMBOL_GPL(ahash_register_instance); 1076 - 1077 - void ahash_request_free(struct ahash_request *req) 1078 - { 1079 - struct ahash_request *tmp; 1080 - struct ahash_request *r2; 1081 - 1082 - if (unlikely(!req)) 1083 - return; 1084 - 1085 - list_for_each_entry_safe(r2, tmp, &req->base.list, base.list) 1086 - kfree_sensitive(r2); 1087 - 1088 - kfree_sensitive(req); 1089 - } 1090 - EXPORT_SYMBOL_GPL(ahash_request_free); 1091 1135 1092 1136 MODULE_LICENSE("GPL"); 1093 1137 MODULE_DESCRIPTION("Asynchronous cryptographic hash type");
+7 -3
crypto/scompress.c
··· 111 111 struct crypto_acomp_stream __percpu *stream = alg->stream; 112 112 int i; 113 113 114 + alg->stream = NULL; 115 + if (!stream) 116 + return; 117 + 114 118 for_each_possible_cpu(i) { 115 119 struct crypto_acomp_stream *ps = per_cpu_ptr(stream, i); 116 120 117 - if (!ps->ctx) 121 + if (IS_ERR_OR_NULL(ps->ctx)) 118 122 break; 119 123 120 124 alg->free_ctx(ps->ctx); ··· 136 132 if (!stream) 137 133 return -ENOMEM; 138 134 135 + alg->stream = stream; 136 + 139 137 for_each_possible_cpu(i) { 140 138 struct crypto_acomp_stream *ps = per_cpu_ptr(stream, i); 141 139 ··· 149 143 150 144 spin_lock_init(&ps->lock); 151 145 } 152 - 153 - alg->stream = stream; 154 146 return 0; 155 147 } 156 148
+3 -3
drivers/crypto/caam/qi.c
··· 122 122 qm_fd_addr_set64(&fd, addr); 123 123 124 124 do { 125 + refcount_inc(&req->drv_ctx->refcnt); 125 126 ret = qman_enqueue(req->drv_ctx->req_fq, &fd); 126 - if (likely(!ret)) { 127 - refcount_inc(&req->drv_ctx->refcnt); 127 + if (likely(!ret)) 128 128 return 0; 129 - } 130 129 130 + refcount_dec(&req->drv_ctx->refcnt); 131 131 if (ret != -EBUSY) 132 132 break; 133 133 num_retries++;
+1 -4
drivers/crypto/tegra/tegra-se-aes.c
··· 269 269 unsigned int cmdlen, key1_id, key2_id; 270 270 int ret; 271 271 272 - rctx->iv = (u32 *)req->iv; 272 + rctx->iv = (ctx->alg == SE_ALG_ECB) ? NULL : (u32 *)req->iv; 273 273 rctx->len = req->cryptlen; 274 274 key1_id = ctx->key1_id; 275 275 key2_id = ctx->key2_id; ··· 497 497 498 498 if (!req->cryptlen) 499 499 return 0; 500 - 501 - if (ctx->alg == SE_ALG_ECB) 502 - req->iv = NULL; 503 500 504 501 rctx->encrypt = encrypt; 505 502
+5 -1
include/crypto/hash.h
··· 10 10 11 11 #include <linux/atomic.h> 12 12 #include <linux/crypto.h> 13 + #include <linux/slab.h> 13 14 #include <linux/string.h> 14 15 15 16 /* Set this bit for virtual address instead of SG list. */ ··· 582 581 * ahash_request_free() - zeroize and free the request data structure 583 582 * @req: request data structure cipher handle to be freed 584 583 */ 585 - void ahash_request_free(struct ahash_request *req); 584 + static inline void ahash_request_free(struct ahash_request *req) 585 + { 586 + kfree_sensitive(req); 587 + } 586 588 587 589 static inline struct ahash_request *ahash_request_cast( 588 590 struct crypto_async_request *req)
+1 -1
include/crypto/internal/hash.h
··· 249 249 250 250 static inline bool ahash_request_chained(struct ahash_request *req) 251 251 { 252 - return crypto_request_chained(&req->base); 252 + return false; 253 253 } 254 254 255 255 static inline bool ahash_request_isvirt(struct ahash_request *req)