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 63F21A0C4B for ; Tue, 12 Oct 2021 16:21:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5721D4116B; Tue, 12 Oct 2021 16:21:50 +0200 (CEST) Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) by mails.dpdk.org (Postfix) with ESMTP id C7C8040E0F; Tue, 12 Oct 2021 16:21:48 +0200 (CEST) Received: by mail-qk1-f170.google.com with SMTP id 77so18287430qkh.6; Tue, 12 Oct 2021 07:21:48 -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=ybRnPRe2iM7emENn2Y6tuldmN4ocxHA7ZSeki2eO9qA=; b=EJsUgjOROfKS9D5uyUhiPWkuxbTYyEwczCMXGwiUssfIzSyEe5BFLG2+wsarzaZQ9p tbMwXBQD/qm6mafxTgy9BtaAmO5QyOfSPXnzO+xaLaWGapTBHQEj8fYXHrVrlRjkM+LN QhkXjbsNh6/8/4hLmVndZMYcMxH8En+etN3fju/DzhjIPfDq+SbsWnRRy66CIMQvtyik hyamyXUJvUuSrzvfLyihofWI5Ozmc2lJwhGlaTm66q0yUGvhz52oyiGw6mfpTrRtDSC1 bJS985cPb25CApkNhhsEx/XJo0IAkDZl7ncMU100IXxTj4eoXpNhqB4wITKTbKirDlR6 WDWQ== 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=ybRnPRe2iM7emENn2Y6tuldmN4ocxHA7ZSeki2eO9qA=; b=1Md7A3q/j1EdP1dFXp849ANn9Of18UPSDTJir4SmWij0upJ3DhaQZ+BxKfkcEQYtAB muTzWZdWi36Ctky9diLsRKXq7zOdef4qxmYmm0opOZ2E2LGWc3MIM8swXQI/CYB7Fs/G J8Vd+GVSt7aJN08OeLhpOuhviA3KmfyRU9hO6aic9qNFrHb1mIhiuZ81odjqFsdA7nGy P98IeEWYIVK4u/z1Zuxc+eJOCWW04dEQSSA3gE7dcUwq5kyRGkiI+dvUFIK6HyeFLP6a ES87HZ4J1wv/6t/DydBI3eoIPwYeEIRwJgu8kTd4Q9ls0MJ5gXfSRsPoZZj+D6M7FvvY W4JQ== X-Gm-Message-State: AOAM530A9NVU8BuSn2poa9pOxkcmz3LR2tqPyAcCPiW5XvQQ7uRc/ywr 3RBtSYX9+ZxYKwfW5iDLeegzARHJ0QM= X-Google-Smtp-Source: ABdhPJylksHArWShI6SUM+3+fhjYkOTM5MsObjPvOMOM1OWlLBGmxWO4tWj0SByWUnWokejLzSS0Kg== X-Received: by 2002:a37:ecb:: with SMTP id 194mr20210522qko.254.1634048507869; Tue, 12 Oct 2021 07:21:47 -0700 (PDT) Received: from lvdi-01-iad-l.blue.trinitycyber.com ([38.142.224.194]) by smtp.gmail.com with ESMTPSA id u16sm3794572qki.47.2021.10.12.07.21.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Oct 2021 07:21:47 -0700 (PDT) From: Ben Magistro To: dev@dpdk.org Cc: stable@dpdk.org, ben.magistro@trinitycyber.com, Ben Magistro Date: Tue, 12 Oct 2021 14:17:53 +0000 Message-Id: <20211012141752.6376-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 v3] 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 Fixes: 4861cde46116 ("i40e: new poll mode driver") 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 0cfe13b7b2..ccdce9a16a 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1564,8 +1564,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(); @@ -1596,11 +1597,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