mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
evm: fix writing <securityfs>/evm overflow
[ Upstream commit 49219d9b8785ba712575c40e48ce0f7461254626 ]
EVM_SETUP_COMPLETE is defined as 0x80000000, which is larger than INT_MAX.
The "-fno-strict-overflow" compiler option properly prevents signaling
EVM that the EVM policy setup is complete. Define and read an unsigned
int.
Fixes: f00d797507 ("EVM: Allow userspace to signal an RSA key has been loaded")
Signed-off-by: Mimi Zohar <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
parent
550cf816bb
commit
4020615bd7
1 changed files with 3 additions and 2 deletions
|
|
@ -68,12 +68,13 @@ static ssize_t evm_read_key(struct file *filp, char __user *buf,
|
|||
static ssize_t evm_write_key(struct file *file, const char __user *buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
int i, ret;
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN) || (evm_initialized & EVM_SETUP_COMPLETE))
|
||||
return -EPERM;
|
||||
|
||||
ret = kstrtoint_from_user(buf, count, 0, &i);
|
||||
ret = kstrtouint_from_user(buf, count, 0, &i);
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in a new issue