From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D9E8606A322 for ; Thu, 3 Dec 2026 21:22:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20260707.gappssmtp.com header.i=@networkplumber-org.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=lB6E+qnP Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E4B55402E7; Thu, 3 Dec 2026 22:22:51 +0100 (CET) Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by mails.dpdk.org (Postfix) with ESMTPS id 1A81C40292 for ; Thu, 3 Dec 2026 22:22:50 +0100 (CET) Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2f07a960666so3024435ad.1 for ; Thu, 03 Dec 2026 13:22:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20260707.gappssmtp.com; s=20260707; t=1796332969; x=1796937769; darn=dpdk.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=AuBLgqneGiqFK2f7cibp7NGtALmRlurYuo5FA4AadQA=; b=lB6E+qnPMDyKAUU9kCHh4vXiC54nSPLQAuS3g19Gtrh/4/hijAuonAn67s4SoLOXh2 zEhBPx45yo12bVp9+AtVQGOap1rc5g70mBWdT34nAdMBUUvfyhjLt9coqTI+yAcHY04/ +4nVtN6Qwj0lZW8buu+0vL3finrXeaUrgy1obwsJDEQN2SawBwXeHjr+Uk6xTnzqqPXy 2Vtj7gTUa1LrIUB5uCQ2eRBvtfOlTedA9hboA5Wxc+5uETLzAzvIPY7bBbsYYNZLwoiE PhIyHZ4qvDERyfNBGEx6CTPrsUfrPjL0huQpJWkQN6NHsJb3CHA9EdORFQfBfAIXja8H pKPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796332969; x=1796937769; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=AuBLgqneGiqFK2f7cibp7NGtALmRlurYuo5FA4AadQA=; b=vxqDZH+OVsYT7l8ad2mHwDuh96rYcLyIPePYRb+wG9IZo28zleN5Np6VWW2VI5MmVP xuDDvi7Gm00UQfzd0bqKi7bQ7qmE2DGGnQmPB44Hf/gGkVSZyFWTD/3BNHh5YC4mlN6L kdxQsrJrPnG0L0gVgjQDS/R6k258B+8OSO92fMsZ9weATaZPITD990BwMiVg9qSYSu/h LKhErGVPY5dV4U/IKrmEjWgdDv3iH8rWL6IXx/UWQLQoJ/Q1im9Ty8lZxaJVxKb4O4sC 8+LvVz+pnN401X4tvG0YG6DsAWjQWiRU1q0IjclwAV6YoM1lu6OIAT6j1qGUBw0zid0o IBqA== X-Forwarded-Encrypted: i=1; AL+hErGgsqwm9eXH4qGsj0opfDSJETjU2XEpGXFvxztFHWlwdIUUff4kU5MTGV6Wmpyn3B08cqM=@dpdk.org X-Gm-Message-State: APuU4Z9rf/bRZQ9oNlhN4V+7wwizY0H25WYz0TxR90AFKQEp5nKpdb3o d0LoTwylaIhacBWl4j/t+A2Fc9VpeColTid8mMLBJrmZjz/HjrM1lewisefy3hHVG98= X-Gm-Gg: AZFdTZevNBrFBHRIz7RGTRAmR7VnsCEmwQldQCeD7skQisT2dbAQY2wNDgjlr50c6/C TZ/SkAA//lkb9ICM2p0D4FbidH13KYx7Jat0vRAanl0XtY+AGBYqBhasGfqNRPAW6+j+FSXsy6N S+4Kgc9Kfb90dI6qOwLdJX+UvAoExXBnU+vCL8ANVq3NrkT/4wbPzP9ZrHjMmGrjC/ZGBd0D+vj vCd5SQfXY8iQLrWQA2/E0chCxhIFZz2k/wtSVU3IQPygdA1gIIJBy1Cs0T1ZOwMNAYyo8L8WrIF 55g/UbBbTnpe3t96x1PvPsIGSmHZmoNKDK3U5m0ZDWCOX4nDLnfYln2klUH1E7JkMEl4qWW/6Uo 0ydG3f8hJ6NXJrc4mq5CHMOuT8sRAFcngBYP9Lnfga25fLqDFBgB8Y9wzWQPG2S9QcMkwsG3ZQO ExlZbo+JtG8yS7biOAj+T7CKGJwBmOiAzrmwNjSxgHFv4CO/cYL78NJpXVZPyWv7ffFAkmjxjYB IIOUh3q8fkGswgz+7S9UsGJG4ri7G2JufpGUQi1uoefhArd7CyO+pn/mkQthrBrKJQlnKBPocKq +J9ee/IFnzTJtMl4n/2ImpBiVDEedcJnoGpi4m/AH42oV9xrMwrv2qZ5g6nk3Ct4xn8PFQ== X-Received: by 2002:a17:903:2447:b0:2ed:146c:cbbb with SMTP id d9443c01a7336-2f03f0fcd38mr479425025ad.17.1796332969218; Thu, 03 Dec 2026 13:22:49 -0800 (PST) Received: from phoenix.local (204-195-112-43.wavecable.com. [204.195.112.43]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2f1b79412c1sm619385ad.50.2026.12.03.13.22.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 13:22:49 -0800 (PST) Date: Thu, 3 Dec 2026 13:22:46 -0800 From: Stephen Hemminger To: Oleg Kotkov Cc: , , , , Subject: Re: [PATCH] net/nbl: fix late device data check in configure callback Message-ID: <20261203132246.5e2aa1aa@phoenix.local> In-Reply-To: <20261202112444.2643835-1-Oleg.Kotkov@kaspersky.com> References: <20261202112444.2643835-1-Oleg.Kotkov@kaspersky.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Wed, 2 Dec 2026 14:24:43 +0300 Oleg Kotkov wrote: > nbl_dev_configure() reads eth_dev->data->dev_private before checking > whether eth_dev->data is NULL. Move the adapter lookup after the check > so the callback can return -EINVAL when device data is missing. > > Fixes: 93b38df5a2ec ("net/nbl: support basic configuration") > Cc: stable@dpdk.org > > Signed-off-by: Oleg Kotkov > --- Some AI review warnings: Warning ------- net/nbl: fix late device data check in configure callback The reordered condition cannot occur, so the patch changes no behaviour and only adds lines. dev_data = eth_dev->data; if (dev_data == NULL) return -EINVAL; rte_eth_dev_configure() dereferences dev->data before it dispatches to the PMD. It reads dev->data->dev_started and then writes dev->data->dev_configured = 0, both in rte_ethdev.c well ahead of the dev_ops->dev_configure(dev) call at rte_ethdev.c:1672, which is the only call site. A NULL eth_dev->data would have crashed in ethdev and never reached this callback. The adapter check is unreachable for the same reason. ETH_DEV_TO_NBL_DEV_PF_PRIV() returns eth_dev->data->dev_private, and dev_private is allocated by rte_eth_dev_pci_allocate(), which calls rte_eth_dev_release_port() and returns NULL if that allocation fails. Probe then fails, so a port that reaches dev_configure always has a non-NULL adapter. Delete both checks instead of reordering them: int nbl_dev_configure(struct rte_eth_dev *eth_dev) { struct rte_eth_dev_data *dev_data = eth_dev->data; struct nbl_adapter *adapter = ETH_DEV_TO_NBL_DEV_PF_PRIV(eth_dev); int ret; NBL_LOG(DEBUG, "Begin to configure the device, state: %d", adapter->state); With no reachable bug, drop the Fixes: tag and Cc: stable@dpdk.org as well; there is nothing for the stable trees to pick up.