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 5A937A0C46 for ; Fri, 17 Sep 2021 16:46:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3B286410EC; Fri, 17 Sep 2021 16:46:04 +0200 (CEST) Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) by mails.dpdk.org (Postfix) with ESMTP id 9946F410EC for ; Fri, 17 Sep 2021 16:46:03 +0200 (CEST) Received: by mail-qk1-f178.google.com with SMTP id p4so18177705qki.3 for ; Fri, 17 Sep 2021 07:46:03 -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=lVRkv2HO/DLupEkdXuTDzafQ4Efg2xlOZ6l0gDK1HrFYfdBdM2QmbELbYnmo2kLPeM EcD3gcBk95ZwjW6Gtruqxtlcr46XpQyL5HRQ8hdW/Oq5TPRH2TbgRpxq89x3jVLvqS2B 2Qhu5AQ/fuaV91H0Ff+klCwfnEiqqC3fcwvncSXXQJVx7Cf3Au/kxm5e/wfHqbJWhtuX 31xsatykxg4pgwTBDQdUXandF/VoyHGs9WeAPDrHw3kMn07/raW1lIBdg72Drl2QL3uo /EGWT79DO8dqX0dgN2irCsEeQFQVF2aSigNRwpvYVb1RvvjNyB+Q5w68Tft4fhmya74Y d/1Q== 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=CQxuQkdgiYAWbdl3r2kEH6bg5Yp6Yq6TiYDcDZt2C5c6sCDKQ1NKlcmUNikySZLSkc QLz+k2TwMZ3meOOZpwV1MecBfcdGCTi/8Zfn0NOrepkprpY0+DTFW+5vuTaNogoBpcCw FipNri1pF86pmKf8w/U0Hj3aOknB0ilvT359E2+6sVhprXbcYDoi3MQIosvkokCoC+wv 1q4RhhN/VRIQs1hfgAiTytpUkiWCvHCp8DVdQJrkCVcFx/mztRj/q0Os91qLotla9+fs l944lPk+lzEX4AkwbnsLq6hbv57cs7z+bycIEAPcgrKUSIhR5mJUgJqRLV34NLfPSAmW OrtQ== X-Gm-Message-State: AOAM532TSOjA0ou8Ya++mG6fZc5FsRWMLdDd6sMV3X3HGdmdpDhQjZrm AhH+mMRJBb7uWI4j8HNy+FauvqH7UGc= X-Google-Smtp-Source: ABdhPJywxB3+3TL4sJDhkF+Yv6ToR7YTGRxxqKS8ENM4IrW3qaeaLmY4Wm5X2jPTrbX9238TLIUDkg== X-Received: by 2002:a37:a391:: with SMTP id m139mr7611366qke.186.1631889962664; Fri, 17 Sep 2021 07:46:02 -0700 (PDT) Received: from lvdi-01-iad-l.blue.trinitycyber.com ([38.142.224.194]) by smtp.gmail.com with ESMTPSA id h4sm4830431qkp.86.2021.09.17.07.46.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Sep 2021 07:46:02 -0700 (PDT) From: Ben Magistro To: stable@dpdk.org Cc: ben.magistro@trinitycyber.com, stefan.baranoff@trinitycyber.com, Ben Magistro Date: Fri, 17 Sep 2021 14:44:03 +0000 Message-Id: <20210917144402.31554-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