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

s390/zcrypt: fix kmalloc 256k failure

Tests showed that under stress conditions the kernel may
temporary fail to allocate 256k with kmalloc. However,
this fix reworks the related code in the cca_findcard2()
function to use kvmalloc instead.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com>
Cc: Stable <stable@vger.kernel.org>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>

authored by

Harald Freudenberger and committed by
Vasily Gorbik
b6186d7f ca589ea8

+4 -4
+4 -4
drivers/s390/crypto/zcrypt_ccamisc.c
··· 1692 1692 *nr_apqns = 0; 1693 1693 1694 1694 /* fetch status of all crypto cards */ 1695 - device_status = kmalloc_array(MAX_ZDEV_ENTRIES_EXT, 1696 - sizeof(struct zcrypt_device_status_ext), 1697 - GFP_KERNEL); 1695 + device_status = kvmalloc_array(MAX_ZDEV_ENTRIES_EXT, 1696 + sizeof(struct zcrypt_device_status_ext), 1697 + GFP_KERNEL); 1698 1698 if (!device_status) 1699 1699 return -ENOMEM; 1700 1700 zcrypt_device_status_mask_ext(device_status); ··· 1762 1762 verify = 0; 1763 1763 } 1764 1764 1765 - kfree(device_status); 1765 + kvfree(device_status); 1766 1766 return rc; 1767 1767 } 1768 1768 EXPORT_SYMBOL(cca_findcard2);