|
Thomas Bogendoerfer |
4b6200 |
From: Ziyang Xuan <william.xuanziyang@huawei.com>
|
|
Thomas Bogendoerfer |
4b6200 |
Date: Fri, 2 Dec 2022 19:04:30 +0800
|
|
Thomas Bogendoerfer |
4b6200 |
Subject: octeontx2-pf: Fix potential memory leak in otx2_init_tc()
|
|
Thomas Bogendoerfer |
4b6200 |
Patch-mainline: v6.1
|
|
Thomas Bogendoerfer |
4b6200 |
Git-commit: fbf33f5ac76f2cdb47ad9763f620026d5cfa57ce
|
|
Thomas Bogendoerfer |
4b6200 |
References: jsc#SLE-24682
|
|
Thomas Bogendoerfer |
4b6200 |
|
|
Thomas Bogendoerfer |
4b6200 |
In otx2_init_tc(), if rhashtable_init() failed, it does not free
|
|
Thomas Bogendoerfer |
4b6200 |
tc->tc_entries_bitmap which is allocated in otx2_tc_alloc_ent_bitmap().
|
|
Thomas Bogendoerfer |
4b6200 |
|
|
Thomas Bogendoerfer |
4b6200 |
Fixes: 2e2a8126ffac ("octeontx2-pf: Unify flow management variables")
|
|
Thomas Bogendoerfer |
4b6200 |
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
|
|
Thomas Bogendoerfer |
4b6200 |
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
|
|
Thomas Bogendoerfer |
4b6200 |
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
Thomas Bogendoerfer |
4b6200 |
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
|
|
Thomas Bogendoerfer |
4b6200 |
---
|
|
Thomas Bogendoerfer |
4b6200 |
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 7 ++++++-
|
|
Thomas Bogendoerfer |
4b6200 |
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
Thomas Bogendoerfer |
4b6200 |
|
|
Thomas Bogendoerfer |
4b6200 |
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
|
|
Thomas Bogendoerfer |
4b6200 |
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
|
|
Thomas Bogendoerfer |
4b6200 |
@@ -1091,7 +1091,12 @@ int otx2_init_tc(struct otx2_nic *nic)
|
|
Thomas Bogendoerfer |
4b6200 |
return err;
|
|
Thomas Bogendoerfer |
4b6200 |
|
|
Thomas Bogendoerfer |
4b6200 |
tc->flow_ht_params = tc_flow_ht_params;
|
|
Thomas Bogendoerfer |
4b6200 |
- return rhashtable_init(&tc->flow_table, &tc->flow_ht_params);
|
|
Thomas Bogendoerfer |
4b6200 |
+ err = rhashtable_init(&tc->flow_table, &tc->flow_ht_params);
|
|
Thomas Bogendoerfer |
4b6200 |
+ if (err) {
|
|
Thomas Bogendoerfer |
4b6200 |
+ kfree(tc->tc_entries_bitmap);
|
|
Thomas Bogendoerfer |
4b6200 |
+ tc->tc_entries_bitmap = NULL;
|
|
Thomas Bogendoerfer |
4b6200 |
+ }
|
|
Thomas Bogendoerfer |
4b6200 |
+ return err;
|
|
Thomas Bogendoerfer |
4b6200 |
}
|
|
Thomas Bogendoerfer |
4b6200 |
EXPORT_SYMBOL(otx2_init_tc);
|
|
Thomas Bogendoerfer |
4b6200 |
|