From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 08D0DA0C43 for ; Tue, 28 Sep 2021 23:23:53 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E7EDE410E5; Tue, 28 Sep 2021 23:23:52 +0200 (CEST) Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) by mails.dpdk.org (Postfix) with ESMTP id 95A8B40E3C; Tue, 28 Sep 2021 23:23:50 +0200 (CEST) Received: by mail-qv1-f48.google.com with SMTP id gs10so196262qvb.13; Tue, 28 Sep 2021 14:23:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cRAr/G50BmdxSeD3N3o9/jhN6vqqn//7qrhAVvcBQAk=; b=NcJzBxx7Hehpia8lLlaLm/lPcoeqsEH3uTwztQupLcuG52Yh1lGbtbtvSC1yneYitV auENWBYE1+8e/vyUsoVgwr1kZYkbnuLhumbPCchJBIJd5/9fg6viulI2GqG9YiBOUdlk y5miUNQm1t7V70dRM2ffTQMzcTIXwrwOaUcjETe2G3DxoXqBtT6z6b03tRNTJBvLkYzG /rSk1l9a+xAFOivKqLuMzpCYIEWurdl45oW5x42wj7mjZ/K/l8GMD4FFeyGnA9cfUHkD EPxLDhBJvDcN9Woaz1QEQMgQs3PZIQBPsTpeI+2ZuzEPEeqyIVxBqyNJw+oAObw4eN7F ebtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cRAr/G50BmdxSeD3N3o9/jhN6vqqn//7qrhAVvcBQAk=; b=o1mPi29GuoDhVx2ArI+HiuXnntm1puKgmvhHAQGTsEh3n00hrIJ2HX+dMZDiqwKDMR xkqi0CCKhKWKOS63QjWvA36wJW1IvtPbZ2hzJqhEzHfzUd4/SyGLmiQrebzweMMETQX3 tqUYuJNXszzzM53xuRu4FbE9+79O1bLK5VgQal06Dr+LAI3OKjxetDeJO92yrsjn9Vjw m5QqCJ+5MvJWMNiwmwVZ7vwZ0VUtK4u4ChQm6GLyYvi3CQy5fmY0ryloJR9CFbxo3cwq m02Mim1CRt/xmrcq4DT0bdfw5KEA+7caqkj88eMdSLHCLkUPbtgt2BtcA+8StTwT2FkP w3bQ== X-Gm-Message-State: AOAM533Ietbcp4JxWKbUCxrj/KkgkUFRWlOA6jV79FMWeCNCpmN8HhGw UGTxYm6mJk+BpvKw0vIiDM291050GFI= X-Google-Smtp-Source: ABdhPJzrp9OHIad1sHPN7t7H99bEcivaKhg3ExcxrJ3mM1w8S8SfX+lsLmcOX3lzhEzMa6lz7E9zeA== X-Received: by 2002:a05:6214:151:: with SMTP id x17mr8190545qvs.38.1632864229579; Tue, 28 Sep 2021 14:23:49 -0700 (PDT) Received: from lvdi-01-iad-l.blue.trinitycyber.com ([38.142.224.194]) by smtp.gmail.com with ESMTPSA id g1sm229038qkd.89.2021.09.28.14.23.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Sep 2021 14:23:49 -0700 (PDT) From: Ben Magistro To: dev@dpdk.org Cc: stable@dpdk.org, ben.magistro@trinitycyber.com, Ben Magistro Date: Tue, 28 Sep 2021 21:23:02 +0000 Message-Id: <20210928212301.403-1-koncept1@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210825194526.14987-1-koncept1@gmail.com> References: <20210825194526.14987-1-koncept1@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH v2, 20.11] net/i40e: fix i40evf device initialization X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" The i40evf driver is not initializing the eth_dev attribute which can result in a nullptr dereference. Changes were modeled after the iavf_dev_init() per suggestion from the mailing list[1]. [1] https://mails.dpdk.org/archives/dev/2021-August/217251.html Cc: stable@dpdk.org Signed-off-by: Ben Magistro --- drivers/net/i40e/i40e_ethdev_vf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 625981048a..1d08064b58 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1562,8 +1562,9 @@ i40evf_dev_alarm_handler(void *param) static int i40evf_dev_init(struct rte_eth_dev *eth_dev) { - struct i40e_hw *hw - = I40E_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + struct i40e_adapter *adapter = + I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private); + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(adapter); struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); PMD_INIT_FUNC_TRACE(); @@ -1594,11 +1595,14 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev) hw->device_id = pci_dev->id.device_id; hw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id; hw->subsystem_device_id = pci_dev->id.subsystem_device_id; + hw->bus.bus_id = pci_dev->addr.bus; hw->bus.device = pci_dev->addr.devid; hw->bus.func = pci_dev->addr.function; hw->hw_addr = (void *)pci_dev->mem_resource[0].addr; hw->adapter_stopped = 1; hw->adapter_closed = 0; + hw->back = I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private); + adapter->eth_dev = eth_dev; if(i40evf_init_vf(eth_dev) != 0) { PMD_INIT_LOG(ERR, "Init vf failed"); -- 2.27.0