Skip to content

Commit b6186d7

Browse files
hfreudeVasily Gorbik
authored andcommitted
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>
1 parent ca589ea commit b6186d7

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎drivers/s390/crypto/zcrypt_ccamisc.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,9 +1692,9 @@ int cca_findcard2(u32 **apqns, u32 *nr_apqns, u16 cardnr, u16 domain,
16921692
*nr_apqns = 0;
16931693

16941694
/* 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);
16981698
if (!device_status)
16991699
return -ENOMEM;
17001700
zcrypt_device_status_mask_ext(device_status);
@@ -1762,7 +1762,7 @@ int cca_findcard2(u32 **apqns, u32 *nr_apqns, u16 cardnr, u16 domain,
17621762
verify = 0;
17631763
}
17641764

1765-
kfree(device_status);
1765+
kvfree(device_status);
17661766
return rc;
17671767
}
17681768
EXPORT_SYMBOL(cca_findcard2);

0 commit comments

Comments
 (0)