Skip to contentSkip to conversation

RDMA/hns: Fix double free of the pointer to TSQ/TPQ

PATCH Applied Weihang Li 2 participants 2 messages Nov 12, 2020

Subsystems (2)
lore
Share & tools
lore

Weihang Li

author
#0 lore raw

PATCH 1/1 RDMA/hns: Fix double free of the pointer to TSQ/TPQ

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")
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +2 -0
index 83842cd..4d697e4 100644
@@ -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);
 
Signature · 1 line
2.8.1
maintainer Applied
#1 lore raw
Quoted 9 lines · Weihang Li

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")
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 ++
 1 file changed, 2 insertions(+)

Applied to for-next, thanks

Jason