Skip to content

Commit d007caa

Browse files
dinghaoliukuba-moo
authored andcommitted
net: bnxt: fix a potential use-after-free in bnxt_init_tc
When flow_indr_dev_register() fails, bnxt_init_tc will free bp->tc_info through kfree(). However, the caller function bnxt_init_one() will ignore this failure and call bnxt_shutdown_tc() on failure of bnxt_dl_register(), where a use-after-free happens. Fix this issue by setting bp->tc_info to NULL after kfree(). Fixes: 627c89d ("bnxt_en: flow_offload: offload tunnel decap rules via indirect callbacks") Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com> Reviewed-by: Michael Chan <michael.chan@broadcom.com> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com> Link: https://lore.kernel.org/r/20231204024004.8245-1-dinghao.liu@zju.edu.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent a61f46e commit d007caa

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2075,6 +2075,7 @@ int bnxt_init_tc(struct bnxt *bp)
20752075
rhashtable_destroy(&tc_info->flow_table);
20762076
free_tc_info:
20772077
kfree(tc_info);
2078+
bp->tc_info = NULL;
20782079
return rc;
20792080
}
20802081

0 commit comments

Comments
 (0)