]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
evm: check hash algorithm passed to init_desc()
authorRoberto Sassu <roberto.sassu@huawei.com>
Wed, 29 May 2019 13:30:33 +0000 (15:30 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 9 Jun 2019 07:16:15 +0000 (09:16 +0200)
commit2f20066d32a90b034ccfbc0b46be21a77e59bdb0
tree84736c3ec8fe9810e6de0e48cc9d976f137c584a
parentb2164f6c3bc97917e51d59fc42ac0d67e400d483
evm: check hash algorithm passed to init_desc()

commit 221be106d75c1b511973301542f47d6000d0b63e upstream.

This patch prevents memory access beyond the evm_tfm array by checking the
validity of the index (hash algorithm) passed to init_desc(). The hash
algorithm can be arbitrarily set if the security.ima xattr type is not
EVM_XATTR_HMAC.

Fixes: 5feeb61183dde ("evm: Allow non-SHA1 digital signatures")
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Cc: stable@vger.kernel.org
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
security/integrity/evm/evm_crypto.c