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 A6DBCA2F18 for ; Thu, 3 Oct 2019 01:27:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BB57E1BFD9; Thu, 3 Oct 2019 01:26:33 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (unknown [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id B92BA1BF92 for ; Thu, 3 Oct 2019 01:26:10 +0200 (CEST) Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.242.48]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 01ACD30C2A3; Wed, 2 Oct 2019 16:24:57 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 01ACD30C2A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1570058697; bh=ehPsAKCuaP0XLpZMxvmDfAl0ZDPv+aKWFBM4KsLkL4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vtm/FDpdw+D8Lu3kTt/aqWS2/TwiOKMYNFI83ZikU4PmisDaSlXlvkXK4fUdKI/0d 9s/+sd3DtpN16IFxVTiKlvePc4OVdnPOxmUiIKr187PB/Ynwsedgiv0mcDHtDp/aR+ S7bYmDQh/vgfO7xh1OH2d5ztr4G1Mw3UPdE8GvR0= Received: from localhost.localdomain (unknown [10.230.30.225]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 1019D14008C; Wed, 2 Oct 2019 16:26:09 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Somnath Kotur , Venkat Duvvuru Date: Wed, 2 Oct 2019 16:25:53 -0700 Message-Id: <20191002232601.22715-13-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20191002232601.22715-1-ajit.khaparde@broadcom.com> References: <20191002232601.22715-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 12/20] net/bnxt: check device is started before flow creation 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" Check device is started before flow creation. Since the vnic data structures aren't created until device start, the driver dereferences NULL vnic if flow creation is attempted before device is started, Reviewed-by: Somnath Kotur Reviewed-by: Venkat Duvvuru Signed-off-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_flow.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index cdfbb6c22f..7fdd50d706 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -1550,6 +1550,15 @@ bnxt_flow_create(struct rte_eth_dev *dev, return NULL; } + if (!dev->data->dev_started) { + rte_flow_error_set(error, + EINVAL, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, + "Device must be started"); + return NULL; + } + flow = rte_zmalloc("bnxt_flow", sizeof(struct rte_flow), 0); if (!flow) { rte_flow_error_set(error, ENOMEM, -- 2.20.1 (Apple Git-117)