Skip to content

Commit

Permalink
octeontx2-pf: Fix potential memory leak in otx2_init_tc()
Browse files Browse the repository at this point in the history
In otx2_init_tc(), if rhashtable_init() failed, it does not free
tc->tc_entries_bitmap which is allocated in otx2_tc_alloc_ent_bitmap().

Fixes: 2e2a812 ("octeontx2-pf: Unify flow management variables")
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ziyang Xuan authored and David S. Miller committed Dec 5, 2022
1 parent 165df24 commit fbf33f5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,12 @@ int otx2_init_tc(struct otx2_nic *nic)
return err;

tc->flow_ht_params = tc_flow_ht_params;
return rhashtable_init(&tc->flow_table, &tc->flow_ht_params);
err = rhashtable_init(&tc->flow_table, &tc->flow_ht_params);
if (err) {
kfree(tc->tc_entries_bitmap);
tc->tc_entries_bitmap = NULL;
}
return err;
}
EXPORT_SYMBOL(otx2_init_tc);

Expand Down

0 comments on commit fbf33f5

Please sign in to comment.