fs_dev_remove() releases the sub-device ethdev port a second time after
it has already been released: for an active sub-device by
rte_eth_dev_close(), and for a probed one by the driver remove called
from rte_dev_remove(). The first release sets eth_dev->data to NULL, so
the second rte_eth_dev_release_port() dereferences a NULL pointer and
crashes during hot-unplug.

Remove the redundant release and let the close and bus remove paths own
the release of the port.

Fixes: fac0ae546e5f ("net/failsafe: free port by dedicated function")
Cc: [email protected]
Signed-off-by: Sandeep Penigalapati <[email protected]>
---
v3:
- Reword the commit message and remove the now-redundant braces.

 drivers/net/failsafe/failsafe_ether.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/failsafe/failsafe_ether.c 
b/drivers/net/failsafe/failsafe_ether.c
index f0fd662c7b..1702b1a604 100644
--- a/drivers/net/failsafe/failsafe_ether.c
+++ b/drivers/net/failsafe/failsafe_ether.c
@@ -298,12 +298,9 @@ fs_dev_remove(struct sub_device *sdev)
                /* fallthrough */
        case DEV_PROBED:
                ret = rte_dev_remove(sdev->dev);
-               if (ret < 0) {
+               if (ret < 0)
                        ERROR("Bus detach failed for sub_device %u",
                              SUB_ID(sdev));
-               } else {
-                       rte_eth_dev_release_port(ETH(sdev));
-               }
                sdev->state = DEV_PARSED;
                /* fallthrough */
        case DEV_PARSED:
-- 
2.34.1

Reply via email to