fixes for bnxt driver
cover fixes for bnxt driver
From: Yunjian Wang <[email protected]>
This series include two fixes patches for bnxt driver.
Yunjian Wang (2):
net/bnxt: fix memory leak when freeing vf_info net/bnxt: add memory allocation check in vf_info init
drivers/net/bnxt/bnxt_ethdev.c | 3 +-- drivers/net/bnxt/bnxt_hwrm.c | 22 ++++++++++++++++++++-- drivers/net/bnxt/bnxt_hwrm.h | 1 + 3 files changed, 22 insertions(+), 4 deletions(-)
Signature · 1 line
2.23.0
PATCH 1/2 net/bnxt: fix memory leak when freeing vf_info
From: Yunjian Wang <[email protected]>
When freeing a vf_info, we should free the 'vlan_as_table' and 'vlan_table' for the vf_info.
--- drivers/net/bnxt/bnxt_ethdev.c | 3 +-- drivers/net/bnxt/bnxt_hwrm.c | 16 +++++++++++++++- drivers/net/bnxt/bnxt_hwrm.h | 1 + 3 files changed, 17 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +1 -2
@@ -1360,8 +1360,7 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)rte_memzone_free ((const struct rte_memzone *)bp->rx_mem_zone); bp->rx_mem_zone =NULL ; -rte_free (bp->pf->vf_info); - bp->pf->vf_info =NULL ; +bnxt_hwrm_free_vf_info (bp);rte_free (bp->grp_info); bp->grp_info =NULL ;
drivers/net/bnxt/bnxt_hwrm.c +15 -1
@@ -670,6 +670,20 @@ static int bnxt_hwrm_ptp_qcfg(struct bnxt *bp)return 0 ; } +void bnxt_hwrm_free_vf_info (struct bnxt *bp) +{ +int i; + +for (i =0 ; i < bp->pf->max_vfs; i++) { +rte_free (bp->pf->vf_info[i].vlan_table); + bp->pf->vf_info[i].vlan_table =NULL ; +rte_free (bp->pf->vf_info[i].vlan_as_table); + bp->pf->vf_info[i].vlan_as_table =NULL ; + } +rte_free (bp->pf->vf_info); + bp->pf->vf_info =NULL ; +} +static int __bnxt_hwrm_func_qcaps (struct bnxt *bp) {int rc =0 ;
@@ -696,7 +710,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) new_max_vfs = bp->pdev->max_vfs;if (new_max_vfs != bp->pf->max_vfs) {if (bp->pf->vf_info) -rte_free (bp->pf->vf_info); +bnxt_hwrm_free_vf_info (bp); bp->pf->vf_info =rte_malloc ("bnxt_vf_info" ,sizeof (bp->pf->vf_info[0 ]) * new_max_vfs,0 ); bp->pf->max_vfs = new_max_vfs;
drivers/net/bnxt/bnxt_hwrm.h +1 -0
@@ -280,4 +280,5 @@ int bnxt_clear_one_vnic_filter(struct bnxt *bp, struct bnxt_filter_info *filter);int bnxt_hwrm_cfa_vfr_alloc (struct bnxt *bp,uint16_t vf_idx);int bnxt_hwrm_cfa_vfr_free (struct bnxt *bp,uint16_t vf_idx); +void bnxt_hwrm_free_vf_info (struct bnxt *bp);#endif
Signature · 1 line
2.23.0
PATCH 2/2 net/bnxt: add memory allocation check in vf_info init
In reply to wangyunjianFrom: Yunjian Wang <[email protected]>
The function rte_malloc() could return NULL, the return value need to be checked.
--- drivers/net/bnxt/bnxt_hwrm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_hwrm.c +5 -1
@@ -711,8 +711,12 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)if (new_max_vfs != bp->pf->max_vfs) {if (bp->pf->vf_info)bnxt_hwrm_free_vf_info (bp); - bp->pf->vf_info =rte_malloc ("bnxt_vf_info" , + bp->pf->vf_info =rte_zmalloc ("bnxt_vf_info" ,sizeof (bp->pf->vf_info[0 ]) * new_max_vfs,0 ); +if (bp->pf->vf_info ==NULL ) { +PMD_DRV_LOG (ERR ,"Alloc vf info fail\n" ); +return -ENOMEM ; + } bp->pf->max_vfs = new_max_vfs;for (i =0 ; i < new_max_vfs; i++) { bp->pf->vf_info[i].fid =
Signature · 1 line
2.23.0
Ping for review, please.
Quoted 25 lines
-----Original Message-----
From: wangyunjian
Sent: Friday, July 31, 2020 8:09 PM
To: [email protected]
Cc: [email protected]; [email protected]; Lilijun (Jerry) <[email protected]>; xudingke <[email protected]>; wangyunjian <[email protected]>
Subject: [dpdk-dev] [PATCH 0/2] fixes for bnxt driverFrom: Yunjian Wang <[email protected]>
This series include two fixes patches for bnxt driver.
Yunjian Wang (2):
net/bnxt: fix memory leak when freeingvf_infonet/bnxt: add memory allocation check invf_infoinitdrivers/net/bnxt/bnxt_ethdev.c | 3 +-- drivers/net/bnxt/bnxt_hwrm.c | 22 ++++++++++++++++++++-- drivers/net/bnxt/bnxt_hwrm.h | 1 + 3 files changed, 22 insertions(+), 4 deletions(-)--
2.23.0
Quoted 3 lines · wangyunjian
Ping for review, please.
yes. It’s in the pipeline and will be applied in a day or two.
Thanks
Ajit
Quoted 56 lines
Quoted 52 lines
-----Original Message-----
From: wangyunjian
Sent: Friday, July 31, 2020 8:09 PM
Cc [email protected]; [email protected]; Lilijun(Jerry) <[email protected]>; xudingke <[email protected]>;
wangyunjian <[email protected]>
Subject: [dpdk-dev] [PATCH 0/2] fixes for bnxt driver
From: Yunjian Wang <[email protected]>
This series include two fixes patches for bnxt driver.
Yunjian Wang (2):
net/bnxt: fix memory leak when freeing
vf_infonet/bnxt: add memory allocation check in
vf_infoinitdrivers/net/bnxt/bnxt_ethdev.c | 3 +--drivers/net/bnxt/bnxt_hwrm.c | 22 ++++++++++++++++++++--drivers/net/bnxt/bnxt_hwrm.h | 1 +3 files changed, 22 insertions(+), 4 deletions(-)--
2.23.0
Quoted 8 lines · wangyunjian
From: Yunjian Wang <[email protected]>
This series include two fixes patches for bnxt driver.
Yunjian Wang (2):
net/bnxt: fix memory leak when freeingvf_infonet/bnxt: add memory allocation check invf_infoinit
Patchset applied to dpdk-next-net-brcm. Thanks
Quoted 11 lines
drivers/net/bnxt/bnxt_ethdev.c | 3 +-- drivers/net/bnxt/bnxt_hwrm.c | 22 ++++++++++++++++++++-- drivers/net/bnxt/bnxt_hwrm.h | 1 + 3 files changed, 22 insertions(+), 4 deletions(-)--
2.23.0