Attempts to enable or disable pdump in primary process
will fail with core dump because it is not valid to call
rte_mp_request_sync() unless in a secondary process.

Trap the error in the common code used for both enable
and disable requests.

Reported-by: Sylvia Grundwürmer <sylvia.grundwuer...@b-plus.com>
Fixes: 660098d61f57 ("pdump: use generic multi-process channel")
Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 lib/pdump/rte_pdump.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c
index 98dcbc037bb8..a81544cb5772 100644
--- a/lib/pdump/rte_pdump.c
+++ b/lib/pdump/rte_pdump.c
@@ -537,6 +537,12 @@ pdump_prepare_client_request(const char *device, uint16_t 
queue,
        struct pdump_request *req = (struct pdump_request *)mp_req.param;
        struct pdump_response *resp;
 
+       if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+               PDUMP_LOG(ERR,
+                         "pdump enable/disable not allowed in primary 
process\n");
+               return -EINVAL;
+       }
+
        memset(req, 0, sizeof(*req));
 
        req->ver = (flags & RTE_PDUMP_FLAG_PCAPNG) ? V2 : V1;
-- 
2.35.1

Reply via email to