From: Jay Ding <[email protected]>

There are some changes made in the 23.11 upstream function
rte_eth_dev_release_port(). The library now sets "eth_dev->data = NULL"
at the end of the routine. This causes a NULL pointer dereference in the
bnxt_rep_link_update_op() and bnxt_vfr_free() routines when it tries to
access the parent dev.

Signed-off-by: Jay Ding <[email protected]>
Reviewed-by: Kalesh AP <[email protected]>
Reviewed-by: Manish Kurup <[email protected]>
---
 drivers/net/bnxt/bnxt_reps.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c
index 6f5c3f80eb..20a0ba65a5 100644
--- a/drivers/net/bnxt/bnxt_reps.c
+++ b/drivers/net/bnxt/bnxt_reps.c
@@ -299,10 +299,10 @@ int bnxt_rep_link_update_op(struct rte_eth_dev *eth_dev, 
int wait_to_compl)
        struct rte_eth_link *link;
        int rc;
 
-       parent_bp = rep->parent_dev->data->dev_private;
-       if (!parent_bp)
+       if (!bnxt_rep_check_parent(rep))
                return 0;
 
+       parent_bp = rep->parent_dev->data->dev_private;
        rc = bnxt_link_update_op(parent_bp->eth_dev, wait_to_compl);
 
        /* Link state. Inherited from PF or trusted VF */
@@ -542,7 +542,7 @@ static int bnxt_vfr_free(struct bnxt_representor *vfr)
 
        if (!bnxt_rep_check_parent(vfr)) {
                PMD_DRV_LOG_LINE(DEBUG, "BNXT Port:%d VFR already freed",
-                           vfr->dpdk_port_id);
+                                vfr->dpdk_port_id);
                return 0;
        }
        parent_bp = vfr->parent_dev->data->dev_private;
-- 
2.39.5 (Apple Git-154)

Reply via email to