patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] app/testpmd: fix crash on cleanup
@ 2023-02-06 15:49 David Marchand
  2023-02-17  7:14 ` Singh, Aman Deep
  0 siblings, 1 reply; 3+ messages in thread
From: David Marchand @ 2023-02-06 15:49 UTC (permalink / raw)
  To: dev
  Cc: stable, Aman Singh, Yuying Zhang, Ferruh Yigit,
	Stephen Hemminger, Thomas Monjalon

If allocating the ports[] array fails, a crash will occur when shutting
down testpmd since ethdev emits RTE_ETH_EVENT_DESTROY events.
Move init_port() before registering ethdev event handler.

Fixes: 85c6571c9103 ("app/testpmd: reset port status on close notification")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test-pmd/testpmd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index e366f81a0f..de3017fd62 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -4385,6 +4385,9 @@ main(int argc, char** argv)
 		rte_exit(EXIT_FAILURE, "Cannot init EAL: %s\n",
 			 rte_strerror(rte_errno));
 
+	/* allocate port structures, and init them */
+	init_port();
+
 	ret = register_eth_event_callback();
 	if (ret != 0)
 		rte_exit(EXIT_FAILURE, "Cannot register for ethdev events");
@@ -4403,9 +4406,6 @@ main(int argc, char** argv)
 	if (nb_ports == 0)
 		TESTPMD_LOG(WARNING, "No probed ethernet devices\n");
 
-	/* allocate port structures, and init them */
-	init_port();
-
 	set_def_fwd_config();
 	if (nb_lcores == 0)
 		rte_exit(EXIT_FAILURE, "No cores defined for forwarding\n"
-- 
2.39.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-17 16:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-06 15:49 [PATCH] app/testpmd: fix crash on cleanup David Marchand
2023-02-17  7:14 ` Singh, Aman Deep
2023-02-17 16:18   ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).