evm: Fix a small race in init_desc()
The IS_ERR_OR_NULL() function has two conditions and if we got really unlucky we could hit a race where "ptr" started as an error pointer and then was set to NULL. Both conditions would be false even though the pointer at the end was NULL. This patch fixes the problem by ensuring that "*tfm" can only be NULL or valid. I have introduced a "tmp_tfm" variable to make that work. I also reversed a condition and pulled the code in one tab. Reported-by: NRoberto Sassu <roberto.sassu@huawei.com> Fixes: 53de3b08 ("evm: Check also if *tfm is an error pointer in init_desc()") Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com> Acked-by: NRoberto Sassu <roberto.sassu@huawei.com> Acked-by: NKrzysztof Struczynski <krzysztof.struczynski@huawei.com> Signed-off-by: NMimi Zohar <zohar@linux.ibm.com>
Showing
想要评论请 注册 或 登录