Skip to content

Commit f7e8098

Browse files
borntraegerVasily Gorbik
authored andcommitted
s390/zcrypt: Fix ZCRYPT_PERDEV_REQCNT ioctl
reqcnt is an u32 pointer but we do copy sizeof(reqcnt) which is the size of the pointer. This means we only copy 8 byte. Let us copy the full monty. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Cc: Harald Freudenberger <freude@linux.ibm.com> Cc: stable@vger.kernel.org Fixes: af4a722 ("s390/zcrypt: Support up to 256 crypto adapters.") Reviewed-by: Harald Freudenberger <freude@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
1 parent ba4f184 commit f7e8098

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/s390/crypto/zcrypt_api.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1449,7 +1449,8 @@ static long zcrypt_unlocked_ioctl(struct file *filp, unsigned int cmd,
14491449
if (!reqcnt)
14501450
return -ENOMEM;
14511451
zcrypt_perdev_reqcnt(reqcnt, AP_DEVICES);
1452-
if (copy_to_user((int __user *) arg, reqcnt, sizeof(reqcnt)))
1452+
if (copy_to_user((int __user *) arg, reqcnt,
1453+
sizeof(u32) * AP_DEVICES))
14531454
rc = -EFAULT;
14541455
kfree(reqcnt);
14551456
return rc;

0 commit comments

Comments
 (0)