Skip to content

Commit fbf33f5

Browse files
Ziyang Xuandavem330
authored andcommitted
octeontx2-pf: Fix potential memory leak in otx2_init_tc()
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 <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 165df24 commit fbf33f5

File tree

1 file changed

+6
-1
lines changed
  • drivers/net/ethernet/marvell/octeontx2/nic

1 file changed

+6
-1
lines changed

drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,12 @@ int otx2_init_tc(struct otx2_nic *nic)
11341134
return err;
11351135

11361136
tc->flow_ht_params = tc_flow_ht_params;
1137-
return rhashtable_init(&tc->flow_table, &tc->flow_ht_params);
1137+
err = rhashtable_init(&tc->flow_table, &tc->flow_ht_params);
1138+
if (err) {
1139+
kfree(tc->tc_entries_bitmap);
1140+
tc->tc_entries_bitmap = NULL;
1141+
}
1142+
return err;
11381143
}
11391144
EXPORT_SYMBOL(otx2_init_tc);
11401145

0 commit comments

Comments
 (0)