diff mbox series

[for-next] RDMA/hns: Fix double free of the pointer to TSQ/TPQ

Message ID 1605180582-46504-1-git-send-email-liweihang@huawei.com (mailing list archive)
State Accepted
Delegated to: Jason Gunthorpe
Headers show
Series [for-next] RDMA/hns: Fix double free of the pointer to TSQ/TPQ | expand

Commit Message

Weihang Li Nov. 12, 2020, 11:29 a.m. UTC
A return statement is omitted after getting HEM table, then the newly
allocated pointer will be freed directly, which will cause a calltrace when
the driver was removed.

Fixes: d6d91e46210f ("RDMA/hns: Add support for configuring GMV table")
Signed-off-by: Weihang Li <liweihang@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jason Gunthorpe Nov. 12, 2020, 5:41 p.m. UTC | #1
On Thu, Nov 12, 2020 at 07:29:42PM +0800, Weihang Li wrote:
> A return statement is omitted after getting HEM table, then the newly
> allocated pointer will be freed directly, which will cause a calltrace when
> the driver was removed.
> 
> Fixes: d6d91e46210f ("RDMA/hns: Add support for configuring GMV table")
> Signed-off-by: Weihang Li <liweihang@huawei.com>
> ---
>  drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied to for-next, thanks

Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 83842cd..4d697e4 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -2582,6 +2582,8 @@  static int hns_roce_v2_init(struct hns_roce_dev *hr_dev)
 	if (ret)
 		goto err_get_hem_table_failed;
 
+	return 0;
+
 err_get_hem_table_failed:
 	hns_roce_free_link_table(hr_dev, &priv->tpq);