提交 85bd06e2 编写于 作者: D Dan Carpenter 提交者: Zheng Zengkai

tee: amdtee: fix an IS_ERR() vs NULL bug

stable inclusion
from stable-v5.10.88
commit 640e28d618e82be78fb43b4bf5113bc90d6aa442
bugzilla: 186058 https://gitee.com/openeuler/kernel/issues/I4QW6A

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=640e28d618e82be78fb43b4bf5113bc90d6aa442

--------------------------------

[ Upstream commit 9d748277 ]

The __get_free_pages() function does not return error pointers it returns
NULL so fix this condition to avoid a NULL dereference.

Fixes: 757cc3e9 ("tee: add AMD-TEE driver")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Acked-by: NRijo Thomas <Rijo-john.Thomas@amd.com>
Signed-off-by: NJens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 8610f5ff
......@@ -203,9 +203,8 @@ static int copy_ta_binary(struct tee_context *ctx, void *ptr, void **ta,
*ta_size = roundup(fw->size, PAGE_SIZE);
*ta = (void *)__get_free_pages(GFP_KERNEL, get_order(*ta_size));
if (IS_ERR(*ta)) {
pr_err("%s: get_free_pages failed 0x%llx\n", __func__,
(u64)*ta);
if (!*ta) {
pr_err("%s: get_free_pages failed\n", __func__);
rc = -ENOMEM;
goto rel_fw;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册