pdump: do not allow enable/disable in primary process

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.

Fixes: 660098d61f ("pdump: use generic multi-process channel")
Cc: stable@dpdk.org

Reported-by: Sylvia Grundwürmer <sylvia.grundwuermer@b-plus.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Stephen Hemminger 2022-10-19 09:37:33 -07:00 committed by David Marchand
parent eb870201b4
commit 8a0cf0c455

View File

@ -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;