From: Danylo Vodopianov <dvo-...@napatech.com> set eth_base to NULL after freeing to prevent use-after-free
CID: 446746 Use after free (USE_AFTER_FREE) Coverity issue: 446746 Fixes: 1d3f62a0c4f1 ("net/ntnic: add base init and deinit of flow API") Signed-off-by: Danylo Vodopianov <dvo-...@napatech.com> --- drivers/net/ntnic/nthw/flow_api/flow_api.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c index 82d4e34ae9..d25d1a3dd1 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -385,8 +385,10 @@ static void flow_ndev_reset(struct flow_nic_dev *ndev) } /* Delete all eth-port devices created on this NIC device */ - while (ndev->eth_base) + while (ndev->eth_base) { flow_delete_eth_dev(ndev->eth_base); + ndev->eth_base = NULL; + } /* Error check */ while (ndev->flow_base) { -- 2.45.0