From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EA4CCA04A4; Tue, 5 May 2020 21:10:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 057E81D6C6; Tue, 5 May 2020 21:10:41 +0200 (CEST) Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by dpdk.org (Postfix) with ESMTP id D91141D6BF for ; Tue, 5 May 2020 21:10:37 +0200 (CEST) Received: from localhost.localdomain (lfbn-idf2-1-566-132.w86-246.abo.wanadoo.fr [86.246.31.132]) (Authenticated sender: grive@u256.net) by relay11.mail.gandi.net (Postfix) with ESMTPSA id C100A100007 for ; Tue, 5 May 2020 19:10:37 +0000 (UTC) From: Gaetan Rivet To: dev@dpdk.org Date: Tue, 5 May 2020 21:10:29 +0200 Message-Id: <16944acc809c06be57c5a489ee7143657c4d8c6f.1588705694.git.grive@u256.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v1 1/3] net/failsafe: avoid crash on malformed eth_dev X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Some PMD do not respect the eth_dev API when allocating their rte_eth_dev. As a result, on device add event resulting from rte_eth_dev_probing_finish() call, the eth_dev processed is incomplete. The segfault is a good way to focus the developer on the issue, but does not inspire confidence. Instead, warn the user of the error repeatedly. The failsafe PMD can warn of the issue and continue. It will repeatedly attempt to initialize the failed port and complain about it, which should result in the same developer focus but with less crashing. Signed-off-by: Gaetan Rivet --- drivers/net/failsafe/failsafe_ether.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c index 93deacd13..2b748bd8b 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -623,6 +623,11 @@ failsafe_eth_new_event_callback(uint16_t port_id, FOREACH_SUBDEV_STATE(sdev, i, fs_dev, DEV_PARSED) { if (sdev->state >= DEV_PROBED) continue; + if (dev->device == NULL) { + WARN("Trying to probe malformed device %s.\n", + sdev->devargs.name); + continue; + } if (strcmp(sdev->devargs.name, dev->device->name) != 0) continue; rte_eth_dev_owner_set(port_id, &PRIV(fs_dev)->my_owner); -- 2.26.2