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

Merge tag 's390-6.9-6' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux

Pull s390 fixes from Alexander Gordeev:

- The function __storage_key_init_range() expects the end address to be
the first byte outside the range to be initialized. Fix the callers
that provide the last byte within the range instead.

- 3270 Channel Command Word (CCW) may contain zero data address in case
there is no data in the request. Add data availability check to avoid
erroneous non-zero value as result of virt_to_dma32(NULL) application
in cases there is no data

- Add missing CFI directives for an unwinder to restore the return
address in the vDSO assembler code

- NUL-terminate kernel buffer when duplicating user space memory region
on Channel IO (CIO) debugfs write inject

- Fix wrong format string in zcrypt debug output

- Return -EBUSY code when a CCA card is temporarily unavailabile

- Restore a loop that retries derivation of a protected key from a
secure key in cases the low level reports temporarily unavailability
with -EBUSY code

* tag 's390-6.9-6' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
s390/paes: Reestablish retry loop in paes
s390/zcrypt: Use EBUSY to indicate temp unavailability
s390/zcrypt: Handle ep11 cprb return code
s390/zcrypt: Fix wrong format string in debug feature printout
s390/cio: Ensure the copied buf is NUL terminated
s390/vdso: Add CFI for RA register to asm macro vdso_func
s390/3270: Fix buffer assignment
s390/mm: Fix clearing storage keys for huge pages
s390/mm: Fix storage key clearing for guest huge pages

+73 -11
+13 -2
arch/s390/crypto/paes_s390.c
··· 125 125 static inline int __paes_keyblob2pkey(struct key_blob *kb, 126 126 struct pkey_protkey *pk) 127 127 { 128 - return pkey_keyblob2pkey(kb->key, kb->keylen, 129 - pk->protkey, &pk->len, &pk->type); 128 + int i, ret = -EIO; 129 + 130 + /* try three times in case of busy card */ 131 + for (i = 0; ret && i < 3; i++) { 132 + if (ret == -EBUSY && in_task()) { 133 + if (msleep_interruptible(1000)) 134 + return -EINTR; 135 + } 136 + ret = pkey_keyblob2pkey(kb->key, kb->keylen, 137 + pk->protkey, &pk->len, &pk->type); 138 + } 139 + 140 + return ret; 130 141 } 131 142 132 143 static inline int __paes_convert_key(struct s390_paes_ctx *ctx)
+1
arch/s390/include/asm/dwarf.h
··· 9 9 #define CFI_DEF_CFA_OFFSET .cfi_def_cfa_offset 10 10 #define CFI_ADJUST_CFA_OFFSET .cfi_adjust_cfa_offset 11 11 #define CFI_RESTORE .cfi_restore 12 + #define CFI_REL_OFFSET .cfi_rel_offset 12 13 13 14 #ifdef CONFIG_AS_CFI_VAL_OFFSET 14 15 #define CFI_VAL_OFFSET .cfi_val_offset
+2
arch/s390/kernel/vdso64/vdso_user_wrapper.S
··· 24 24 CFI_DEF_CFA_OFFSET (STACK_FRAME_OVERHEAD + WRAPPER_FRAME_SIZE) 25 25 CFI_VAL_OFFSET 15, -STACK_FRAME_OVERHEAD 26 26 stg %r14,STACK_FRAME_OVERHEAD(%r15) 27 + CFI_REL_OFFSET 14, STACK_FRAME_OVERHEAD 27 28 brasl %r14,__s390_vdso_\func 28 29 lg %r14,STACK_FRAME_OVERHEAD(%r15) 30 + CFI_RESTORE 14 29 31 aghi %r15,WRAPPER_FRAME_SIZE 30 32 CFI_DEF_CFA_OFFSET STACK_FRAME_OVERHEAD 31 33 CFI_RESTORE 15
+1 -1
arch/s390/mm/gmap.c
··· 2661 2661 return 0; 2662 2662 2663 2663 start = pmd_val(*pmd) & HPAGE_MASK; 2664 - end = start + HPAGE_SIZE - 1; 2664 + end = start + HPAGE_SIZE; 2665 2665 __storage_key_init_range(start, end); 2666 2666 set_bit(PG_arch_1, &page->flags); 2667 2667 cond_resched();
+1 -1
arch/s390/mm/hugetlbpage.c
··· 139 139 } 140 140 141 141 if (!test_and_set_bit(PG_arch_1, &page->flags)) 142 - __storage_key_init_range(paddr, paddr + size - 1); 142 + __storage_key_init_range(paddr, paddr + size); 143 143 } 144 144 145 145 void __set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
+4 -2
drivers/s390/char/raw3270.c
··· 162 162 /* 163 163 * Setup ccw. 164 164 */ 165 - rq->ccw.cda = virt_to_dma32(rq->buffer); 165 + if (rq->buffer) 166 + rq->ccw.cda = virt_to_dma32(rq->buffer); 166 167 rq->ccw.flags = CCW_FLAG_SLI; 167 168 168 169 return rq; ··· 189 188 return -EBUSY; 190 189 rq->ccw.cmd_code = 0; 191 190 rq->ccw.count = 0; 192 - rq->ccw.cda = virt_to_dma32(rq->buffer); 191 + if (rq->buffer) 192 + rq->ccw.cda = virt_to_dma32(rq->buffer); 193 193 rq->ccw.flags = CCW_FLAG_SLI; 194 194 rq->rescnt = 0; 195 195 rq->rc = 0;
+1 -1
drivers/s390/cio/cio_inject.c
··· 95 95 return -EINVAL; 96 96 } 97 97 98 - buffer = vmemdup_user(buf, lbuf); 98 + buffer = memdup_user_nul(buf, lbuf); 99 99 if (IS_ERR(buffer)) 100 100 return -ENOMEM; 101 101
+3 -3
drivers/s390/crypto/zcrypt_ccamisc.c
··· 658 658 (int)prepcblk->ccp_rtcode, 659 659 (int)prepcblk->ccp_rscode); 660 660 if (prepcblk->ccp_rtcode == 8 && prepcblk->ccp_rscode == 2290) 661 - rc = -EAGAIN; 661 + rc = -EBUSY; 662 662 else 663 663 rc = -EIO; 664 664 goto out; ··· 1263 1263 (int)prepcblk->ccp_rtcode, 1264 1264 (int)prepcblk->ccp_rscode); 1265 1265 if (prepcblk->ccp_rtcode == 8 && prepcblk->ccp_rscode == 2290) 1266 - rc = -EAGAIN; 1266 + rc = -EBUSY; 1267 1267 else 1268 1268 rc = -EIO; 1269 1269 goto out; ··· 1426 1426 (int)prepcblk->ccp_rtcode, 1427 1427 (int)prepcblk->ccp_rscode); 1428 1428 if (prepcblk->ccp_rtcode == 8 && prepcblk->ccp_rscode == 2290) 1429 - rc = -EAGAIN; 1429 + rc = -EBUSY; 1430 1430 else 1431 1431 rc = -EIO; 1432 1432 goto out;
+47 -1
drivers/s390/crypto/zcrypt_ep11misc.c
··· 556 556 pl += 2; 557 557 ret = *((u32 *)pl); 558 558 if (ret != 0) { 559 - ZCRYPT_DBF_ERR("%s return value 0x%04x != 0\n", func, ret); 559 + ZCRYPT_DBF_ERR("%s return value 0x%08x != 0\n", func, ret); 560 560 return -EIO; 561 + } 562 + 563 + return 0; 564 + } 565 + 566 + /* Check ep11 reply cprb, return 0 or suggested errno value. */ 567 + static int check_reply_cprb(const struct ep11_cprb *rep, const char *func) 568 + { 569 + /* check ep11 reply return code field */ 570 + if (rep->ret_code) { 571 + ZCRYPT_DBF_ERR("%s ep11 reply ret_code=0x%08x\n", __func__, 572 + rep->ret_code); 573 + if (rep->ret_code == 0x000c0003) 574 + return -EBUSY; 575 + else 576 + return -EIO; 561 577 } 562 578 563 579 return 0; ··· 643 627 goto out; 644 628 } 645 629 630 + /* check ep11 reply cprb */ 631 + rc = check_reply_cprb(rep, __func__); 632 + if (rc) 633 + goto out; 634 + 635 + /* check payload */ 646 636 rc = check_reply_pl((u8 *)rep_pl, __func__); 647 637 if (rc) 648 638 goto out; ··· 899 877 goto out; 900 878 } 901 879 880 + /* check ep11 reply cprb */ 881 + rc = check_reply_cprb(rep, __func__); 882 + if (rc) 883 + goto out; 884 + 885 + /* check payload */ 902 886 rc = check_reply_pl((u8 *)rep_pl, __func__); 903 887 if (rc) 904 888 goto out; ··· 1056 1028 goto out; 1057 1029 } 1058 1030 1031 + /* check ep11 reply cprb */ 1032 + rc = check_reply_cprb(rep, __func__); 1033 + if (rc) 1034 + goto out; 1035 + 1036 + /* check payload */ 1059 1037 rc = check_reply_pl((u8 *)rep_pl, __func__); 1060 1038 if (rc) 1061 1039 goto out; ··· 1219 1185 goto out; 1220 1186 } 1221 1187 1188 + /* check ep11 reply cprb */ 1189 + rc = check_reply_cprb(rep, __func__); 1190 + if (rc) 1191 + goto out; 1192 + 1193 + /* check payload */ 1222 1194 rc = check_reply_pl((u8 *)rep_pl, __func__); 1223 1195 if (rc) 1224 1196 goto out; ··· 1379 1339 goto out; 1380 1340 } 1381 1341 1342 + /* check ep11 reply cprb */ 1343 + rc = check_reply_cprb(rep, __func__); 1344 + if (rc) 1345 + goto out; 1346 + 1347 + /* check payload */ 1382 1348 rc = check_reply_pl((u8 *)rep_pl, __func__); 1383 1349 if (rc) 1384 1350 goto out;