Skip to content

Commit 1d8c270

Browse files
holger-denglerAlexander Gordeev
authored andcommitted
s390/pkey: Wipe sensitive data on failure
Wipe sensitive data from stack also if the copy_to_user() fails. Suggested-by: Heiko Carstens <[email protected]> Reviewed-by: Harald Freudenberger <[email protected]> Reviewed-by: Ingo Franzki <[email protected]> Acked-by: Heiko Carstens <[email protected]> Signed-off-by: Holger Dengler <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]>
1 parent 22e6824 commit 1d8c270

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/s390/crypto/pkey_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,7 @@ static long pkey_unlocked_ioctl(struct file *filp, unsigned int cmd,
13771377
if (rc)
13781378
break;
13791379
if (copy_to_user(ucs, &kcs, sizeof(kcs)))
1380-
return -EFAULT;
1380+
rc = -EFAULT;
13811381
memzero_explicit(&kcs, sizeof(kcs));
13821382
break;
13831383
}
@@ -1412,7 +1412,7 @@ static long pkey_unlocked_ioctl(struct file *filp, unsigned int cmd,
14121412
if (rc)
14131413
break;
14141414
if (copy_to_user(ucp, &kcp, sizeof(kcp)))
1415-
return -EFAULT;
1415+
rc = -EFAULT;
14161416
memzero_explicit(&kcp, sizeof(kcp));
14171417
break;
14181418
}

0 commit comments

Comments
 (0)