Skip to content

Commit 49219d9

Browse files
committed
evm: fix writing <securityfs>/evm overflow
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: f00d797 ("EVM: Allow userspace to signal an RSA key has been loaded") Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
1 parent d07f6ca commit 49219d9

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

security/integrity/evm/evm_secfs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,13 @@ static ssize_t evm_read_key(struct file *filp, char __user *buf,
6666
static ssize_t evm_write_key(struct file *file, const char __user *buf,
6767
size_t count, loff_t *ppos)
6868
{
69-
int i, ret;
69+
unsigned int i;
70+
int ret;
7071

7172
if (!capable(CAP_SYS_ADMIN) || (evm_initialized & EVM_SETUP_COMPLETE))
7273
return -EPERM;
7374

74-
ret = kstrtoint_from_user(buf, count, 0, &i);
75+
ret = kstrtouint_from_user(buf, count, 0, &i);
7576

7677
if (ret)
7778
return ret;

0 commit comments

Comments
 (0)