diff options
author | Roberto Sassu <roberto.sassu@huawei.com> | 2020-04-27 12:28:56 +0200 |
---|---|---|
committer | Mimi Zohar <zohar@linux.ibm.com> | 2020-05-08 03:30:58 +0200 |
commit | 53de3b080d5eae31d0de219617155dcc34e7d698 (patch) | |
tree | f163f0adbe08a441fa3f511bedf14db99a8da68c /net | |
parent | ima: Set file->f_mode instead of file->f_flags in ima_calc_file_hash() (diff) | |
download | linux-53de3b080d5eae31d0de219617155dcc34e7d698.tar.xz linux-53de3b080d5eae31d0de219617155dcc34e7d698.zip |
evm: Check also if *tfm is an error pointer in init_desc()
This patch avoids a kernel panic due to accessing an error pointer set by
crypto_alloc_shash(). It occurs especially when there are many files that
require an unsupported algorithm, as it would increase the likelihood of
the following race condition:
Task A: *tfm = crypto_alloc_shash() <= error pointer
Task B: if (*tfm == NULL) <= *tfm is not NULL, use it
Task B: rc = crypto_shash_init(desc) <= panic
Task A: *tfm = NULL
This patch uses the IS_ERR_OR_NULL macro to determine whether or not a new
crypto context must be created.
Cc: stable@vger.kernel.org
Fixes: d46eb3699502b ("evm: crypto hash replaced by shash")
Co-developed-by: Krzysztof Struczynski <krzysztof.struczynski@huawei.com>
Signed-off-by: Krzysztof Struczynski <krzysztof.struczynski@huawei.com>
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Diffstat (limited to 'net')
0 files changed, 0 insertions, 0 deletions