Skip to content

Commit 835ae3b

Browse files
author
Al Viro
committed
drivers/crypto/ccp/sev-dev.c: get rid of pointless access_ok()
Contrary to the comments, those do *NOT* verify anything about writability of memory, etc. In all cases addresses are passed only to copy_to_user(). Signed-off-by: Al Viro <[email protected]>
1 parent 9053fc9 commit 835ae3b

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

drivers/crypto/ccp/sev-dev.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,7 @@ static int sev_ioctl_do_pek_csr(struct sev_issue_cmd *argp, bool writable)
371371
goto cmd;
372372

373373
/* allocate a physically contiguous buffer to store the CSR blob */
374-
if (!access_ok(input.address, input.length) ||
375-
input.length > SEV_FW_BLOB_MAX_SIZE) {
374+
if (input.length > SEV_FW_BLOB_MAX_SIZE) {
376375
ret = -EFAULT;
377376
goto e_free;
378377
}
@@ -609,12 +608,6 @@ static int sev_ioctl_do_get_id2(struct sev_issue_cmd *argp)
609608
if (copy_from_user(&input, (void __user *)argp->data, sizeof(input)))
610609
return -EFAULT;
611610

612-
/* Check if we have write access to the userspace buffer */
613-
if (input.address &&
614-
input.length &&
615-
!access_ok(input.address, input.length))
616-
return -EFAULT;
617-
618611
data = kzalloc(sizeof(*data), GFP_KERNEL);
619612
if (!data)
620613
return -ENOMEM;
@@ -730,15 +723,13 @@ static int sev_ioctl_do_pdh_export(struct sev_issue_cmd *argp, bool writable)
730723
goto cmd;
731724

732725
/* Allocate a physically contiguous buffer to store the PDH blob. */
733-
if ((input.pdh_cert_len > SEV_FW_BLOB_MAX_SIZE) ||
734-
!access_ok(input.pdh_cert_address, input.pdh_cert_len)) {
726+
if (input.pdh_cert_len > SEV_FW_BLOB_MAX_SIZE) {
735727
ret = -EFAULT;
736728
goto e_free;
737729
}
738730

739731
/* Allocate a physically contiguous buffer to store the cert chain blob. */
740-
if ((input.cert_chain_len > SEV_FW_BLOB_MAX_SIZE) ||
741-
!access_ok(input.cert_chain_address, input.cert_chain_len)) {
732+
if (input.cert_chain_len > SEV_FW_BLOB_MAX_SIZE) {
742733
ret = -EFAULT;
743734
goto e_free;
744735
}

0 commit comments

Comments
 (0)