mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
s390/pkey: Check length in pkey_pckmo handler implementation
Explicitly check the length of the target buffer in the pkey_pckmo
implementation of the key_to_protkey() handler function. The handler
function fails, if the generated output data exceeds the length of the
provided target buffer.
Cc: stable@vger.kernel.org
Fixes: 8fcc231ce3 ("s390/pkey: Introduce pkey base with handler registry and handler modules")
Reported-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
This commit is contained in:
parent
b3d4ab2d7d
commit
1ac287e2af
|
|
@ -257,6 +257,10 @@ static int pckmo_key2protkey(const u8 *key, u32 keylen,
|
|||
goto out;
|
||||
break;
|
||||
}
|
||||
if (t->len > *protkeylen) {
|
||||
rc = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
memcpy(protkey, t->protkey, t->len);
|
||||
*protkeylen = t->len;
|
||||
*protkeytype = t->keytype;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user