diff options
author | Lijun Ou <oulijun@huawei.com> | 2016-09-20 17:07:03 +0100 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-10-03 11:43:15 -0400 |
commit | 1cd11064da4b0bca992ca0f9594adbf53df25879 (patch) | |
tree | ac621e1c433ac5dcc7ce3f3a7d2b4c638c6502e7 /drivers/infiniband | |
parent | 49fdf6bb0a172a8fe631d89a421857336efc4382 (diff) | |
download | talos-obmc-linux-1cd11064da4b0bca992ca0f9594adbf53df25879.tar.gz talos-obmc-linux-1cd11064da4b0bca992ca0f9594adbf53df25879.zip |
IB/hns: Fix bug of memory leakage for registering user mr
While the page size attribute of umem is illegal, we should release
umem that get by ib_umem_get interface.
Also, we should return a non-zero value while pbl number is wrong.
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Dongdong Huang(Donald) <hdd.huang@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/hns/hns_roce_mr.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c index 59f5e2be046b..fb87883ead34 100644 --- a/drivers/infiniband/hw/hns/hns_roce_mr.c +++ b/drivers/infiniband/hw/hns/hns_roce_mr.c @@ -564,11 +564,14 @@ struct ib_mr *hns_roce_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, if (mr->umem->page_size != HNS_ROCE_HEM_PAGE_SIZE) { dev_err(dev, "Just support 4K page size but is 0x%x now!\n", mr->umem->page_size); + ret = -EINVAL; + goto err_umem; } if (n > HNS_ROCE_MAX_MTPT_PBL_NUM) { dev_err(dev, " MR len %lld err. MR is limited to 4G at most!\n", length); + ret = -EINVAL; goto err_umem; } |