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 8D966A04A4; Tue, 5 May 2020 21:11:03 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9A66C1D6D9; Tue, 5 May 2020 21:10:43 +0200 (CEST) Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by dpdk.org (Postfix) with ESMTP id 021B61D6C2 for ; Tue, 5 May 2020 21:10:39 +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 143AE100007; Tue, 5 May 2020 19:10:38 +0000 (UTC) From: Gaetan Rivet To: dev@dpdk.org Cc: wangyunjian@huawei.com, Ali Alnubani Date: Tue, 5 May 2020 21:10:31 +0200 Message-Id: <7286631f479ef296b4c6b3ff41c5ca52504b0834.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 3/3] net/failsafe: fix default service proxy state 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" The service proxy is initialized at 0. This is assuming that all of its fields are invalid at 0. The issue is that a file descriptor at 0 is a valid one. The value -1 is used as sentinel during cleanup. Initialize the RX proxy file descriptor to -1. Fixes: 366226dd859f ("net/failsafe: fix fd leak") Signed-off-by: Gaetan Rivet Cc: wangyunjian@huawei.com Cc: Ali Alnubani --- drivers/net/failsafe/failsafe.c | 1 + drivers/net/failsafe/failsafe_private.h | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index 8af31d71b..72362f35d 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -190,6 +190,7 @@ fs_eth_dev_create(struct rte_vdev_device *vdev) } priv = PRIV(dev); priv->data = dev->data; + priv->rxp = FS_RX_PROXY_INIT; dev->dev_ops = &failsafe_ops; dev->data->mac_addrs = &PRIV(dev)->mac_addrs[0]; dev->data->dev_link = eth_link; diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index 8e9706aef..651578a12 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -58,6 +58,14 @@ struct rx_proxy { enum rxp_service_state sstate; }; +#define FS_RX_PROXY_INIT (struct rx_proxy){ \ + .efd = -1, \ + .evec = NULL, \ + .sid = 0, \ + .scid = 0, \ + .sstate = SS_NO_SERVICE, \ +} + struct rxq { struct fs_priv *priv; uint16_t qid; -- 2.26.2