提交 65d1d345 编写于 作者: L Lang Cheng 提交者: Xie XiuQi

RDMA/hns: Fixup bug of null point checking

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

In addition to the error value,
we should also check the ib_umem_get return null pointer.
Signed-off-by: NLang Cheng <chenglang@huawei.com>
Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 3cc8fe6d
......@@ -31,8 +31,11 @@ int hns_roce_db_map_user(struct hns_roce_ucontext *context, unsigned long virt,
page->user_virt = (virt & PAGE_MASK);
page->umem = ib_umem_get(&context->ibucontext, virt & PAGE_MASK,
PAGE_SIZE, 0, 0);
if (IS_ERR(page->umem)) {
ret = PTR_ERR(page->umem);
if (IS_ERR_OR_NULL(page->umem)) {
if (!page->umem)
ret = -EINVAL;
else
ret = PTR_ERR(page->umem);
kfree(page);
goto out;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册