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 4FAD8A0C4E for ; Mon, 8 Nov 2021 16:56:08 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 462C7410FD; Mon, 8 Nov 2021 16:56:08 +0100 (CET) Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) by mails.dpdk.org (Postfix) with ESMTP id 3024E410FD; Mon, 8 Nov 2021 16:56:07 +0100 (CET) Received: by mail-qv1-f43.google.com with SMTP id b17so12171464qvl.9; Mon, 08 Nov 2021 07:56:07 -0800 (PST) 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=EUweSTMMxQqOBJznrkUb2l7xQSTI/3IH4dbBmv4inJo=; b=imoXyoXsCubMPCFJdDW8tNxVMzVOpAzOy9rZkxWtIk58KRW4D5zLsufyonvGqB8gNN S6uvX1KCmwZKzzrIximG5PmC2Kc3S6xAVPmRY+gmQXRJ+9JFPJ3y0+pa1lFuxkDyIaZ3 MjlT0OPJfh88DfXRUV/x7tGOuTAj+ewtGRXyIT4Ck7sVlnul7AAtTCEWyqb7EYe66sgS 88LvniPRVMwU37fjFp/Sw3FhnmlatsqoCu1NOk7WVDVcOgP+/qeaDF1Gl8qUtdpbltam sxm9p2W4WGngIJxVKRf1mEgi54Y3KJGncGMnd9ljDH6Anab5q40yDHfzj8HF5bFNMjO/ Qkwg== 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=EUweSTMMxQqOBJznrkUb2l7xQSTI/3IH4dbBmv4inJo=; b=TwFCrF1ZKABRGF+hVKxixYHe+xZhccG854m1dEmfUHrKP8prtyeHtxOkOflx9NnJ5p s0J+ndC69y2xY/XG+ALjbej6Mz/Gs7TWVlTEZVENkdd3CpQHEb+3NZfKILasNhpdhxbA rya1Y3jrKyawqDJnGzNRRSck4kUVcQEwCIRBvSlnA8RgUweBIVGokfDL+Motn/wG1QF1 zJl6w6ntf6lz8DuYxYawpwZHr75nck3fgV6XwIdnUkKoYRHCyh4ceKM63wDDx7qjYbbI 3TYC3ZsOwutOfobZyNE2Fie0B9zJrEU8kQ2py9eNnHJKOeGmM45vadMmWqTroqid0rUE UFgQ== X-Gm-Message-State: AOAM532somlNaFcC3ItVJPIG9Q26RIkl1dlBbGxoFQ9c2byJUGDCPjI0 XMjyBTsJcvlsWopgRyK+3FGRFqNWU8s= X-Google-Smtp-Source: ABdhPJyC8MC3U0CPWNjaQBDtOWuFMwHdIvQ8rW7lduBc+D7JnZU4AQV5I1zAKQy907/z43dzvwubBA== X-Received: by 2002:a0c:e708:: with SMTP id d8mr350481qvn.62.1636386966346; Mon, 08 Nov 2021 07:56:06 -0800 (PST) Received: from lvdi-01-iad-l.blue.trinitycyber.com ([38.142.224.194]) by smtp.gmail.com with ESMTPSA id bk11sm5240196qkb.32.2021.11.08.07.56.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Nov 2021 07:56:05 -0800 (PST) From: Ben Magistro To: dev@dpdk.org Cc: stable@dpdk.org, ben.magistro@trinitycyber.com, Ben Magistro Date: Mon, 8 Nov 2021 15:54:50 +0000 Message-Id: <20211108155449.31323-1-koncept1@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211012141752.6376-1-koncept1@gmail.com> References: <20211012141752.6376-1-koncept1@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH v4] 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] and i40evf_init_vf(). [1] https://mails.dpdk.org/archives/dev/2021-August/217251.html Rebased on v20.11.3. Fixes: 4861cde46116 ("i40e: new poll mode driver") Cc: stable@dpdk.org Signed-off-by: Ben Magistro --- drivers/net/i40e/i40e_ethdev_vf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 625981048a..adfe4f12f7 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1564,6 +1564,7 @@ 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_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(eth_dev->data->dev_private); struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); PMD_INIT_FUNC_TRACE(); @@ -1594,12 +1595,17 @@ 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; + vf->adapter = I40E_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private); + vf->dev_data = eth_dev->data; + hw->back = I40E_DEV_PRIVATE_TO_ADAPTER(vf); + if(i40evf_init_vf(eth_dev) != 0) { PMD_INIT_LOG(ERR, "Init vf failed"); return -1; -- 2.27.0