net/octeontx: fix memory leak of MAC address table
PATCH 1/1 net/octeontx: fix memory leak of MAC address table
MAC address table is allocated during octeontx device create and same is used to maintain list of MAC address associated to port. This table is not getting freed niether in case of error nor during graceful shutdown of port.
Patch fixes memory required memory for both the cases as mentioned.
--- drivers/net/octeontx/octeontx_ethdev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/octeontx/octeontx_ethdev.c +7 -1
@@ -351,6 +351,10 @@ octeontx_dev_close(struct rte_eth_dev *dev)rte_free (txq); } +/* Free MAC address table */ +rte_free (dev->data->mac_addrs); + dev->data->mac_addrs =NULL ; + dev->tx_pkt_burst =NULL ; dev->rx_pkt_burst =NULL ; }
@@ -1143,7 +1147,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev,octeontx_log_err ("eth_dev->port_id (%d) is diff to orig (%d)" , data->port_id, nic->port_id); res = -EINVAL ; - goto err; + goto free_mac_addrs; }/* Update port_id mac to eth_dev */
@@ -1162,6 +1166,8 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev,rte_eth_dev_probing_finish (eth_dev);return data->port_id; +free_mac_addrs: +rte_free (data->mac_addrs); err:if (nic)octeontx_port_close (nic);
Signature · 1 line
2.17.1
Quoted 10 lines · Sunil Kumar Kori
MAC address table is allocated during octeontx device create and same is used to maintain list of MAC address associated to port. This table is not getting freed niether in case of error nor during graceful shutdown of port.
Patch fixes memory required memory for both the cases as mentioned.
Fixes f18b146c498d ("net/octeontx: create ethdev ports")Signed-off-by Sunil Kumar Kori <[email protected]>
Quoted 40 lines
--- drivers/net/octeontx/octeontx_ethdev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/net/octeontx/octeontx_ethdev.c +7
-1@@ -351,6 +351,10 @@ octeontx_dev_close(struct rte_eth_dev *dev)rte_free (txq); } +/* Free MAC address table */ +rte_free (dev->data->mac_addrs); + dev->data->mac_addrs =NULL ; + dev->tx_pkt_burst =NULL ; dev->rx_pkt_burst =NULL ; }@@ -1143,7 +1147,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev,octeontx_log_err ("eth_dev->port_id (%d) is diff to orig (%d)" , data->port_id, nic->port_id); res = -EINVAL ; - goto err; + goto free_mac_addrs; }/* Update port_id mac to eth_dev */ @@ -1162,6 +1166,8 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev,rte_eth_dev_probing_finish (eth_dev);return data->port_id; +free_mac_addrs: +rte_free (data->mac_addrs); err:if (nic)octeontx_port_close (nic);Signature · 1 line
2.17.1
Jerin Jacob
AppliedQuoted 10 lines · Harman Kalra
Quoted 8 lines · Sunil Kumar Kori
MAC address table is allocated during octeontx device create and same is used to maintain list of MAC address associated to port. This table is not getting freed niether in case of error nor during graceful shutdown of port.
Patch fixes memory required memory for both the cases as mentioned.
Fixes f18b146c498d ("net/octeontx: create ethdev ports")
Quoted 4 lines
Quoted 2 lines
Signed-off-by Sunil Kumar Kori <[email protected]>Acked-by Harman Kalra <[email protected]>
Applied to dpdk-next-net-mrvl/master. Thanks
Quoted 41 lines
Quoted 41 lines
--- drivers/net/octeontx/octeontx_ethdev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/net/octeontx/octeontx_ethdev.c +7
-2@@ -351,6 +351,10 @@ octeontx_dev_close(struct rte_eth_dev *dev)rte_free (txq); } +/* Free MAC address table */ +rte_free (dev->data->mac_addrs); + dev->data->mac_addrs =NULL ; + dev->tx_pkt_burst =NULL ; dev->rx_pkt_burst =NULL ; }@@ -1143,7 +1147,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev,octeontx_log_err ("eth_dev->port_id (%d) is diff to orig (%d)" , data->port_id, nic->port_id); res = -EINVAL ; - goto err; + goto free_mac_addrs; }/* Update port_id mac to eth_dev */ @@ -1162,6 +1166,8 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev,rte_eth_dev_probing_finish (eth_dev);return data->port_id; +free_mac_addrs: +rte_free (data->mac_addrs); err:if (nic)octeontx_port_close (nic); --2.17.1