DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ben Magistro <koncept1@gmail.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, ben.magistro@trinitycyber.com,
	Ben Magistro <koncept1@gmail.com>
Subject: [dpdk-dev] [PATCH v4] net/i40e: fix i40evf device initialization
Date: Mon,  8 Nov 2021 15:54:50 +0000	[thread overview]
Message-ID: <20211108155449.31323-1-koncept1@gmail.com> (raw)
In-Reply-To: <20211012141752.6376-1-koncept1@gmail.com>

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 <koncept1@gmail.com>
---
 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


  parent reply	other threads:[~2021-11-08 15:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-25 19:45 [dpdk-dev] [PATCH] driver: " Ben Magistro
2021-08-26 10:25 ` Ferruh Yigit
2021-08-26 10:46   ` Kevin Traynor
2021-08-27  6:28     ` Xueming(Steven) Li
2021-08-30  9:43       ` Ferruh Yigit
2021-09-02 12:37         ` Xueming(Steven) Li
2021-09-14  2:52           ` Ben Magistro
2021-10-13 13:21             ` Ben Magistro
2021-10-15 11:10               ` Xueming(Steven) Li
2021-09-28 21:23 ` [dpdk-dev] [PATCH v2, 20.11] net/i40e: fix " Ben Magistro
2021-10-12 14:17 ` [dpdk-dev] [PATCH v3] " Ben Magistro
2021-11-08 11:21   ` Xueming(Steven) Li
2021-11-08 15:54   ` Ben Magistro [this message]
2021-11-27 13:34     ` [dpdk-stable][20.11] [PATCH v4] " Xueming(Steven) Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211108155449.31323-1-koncept1@gmail.com \
    --to=koncept1@gmail.com \
    --cc=ben.magistro@trinitycyber.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).