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 6040B43B67 for ; Fri, 8 Mar 2024 15:31:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5B08B42F0D; Fri, 8 Mar 2024 15:31:25 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 78FDA40E2D for ; Fri, 8 Mar 2024 15:31:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709908283; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hhri07atuIZQcuH5wo3nzeo8x0/5h2WG85aZCouo8yE=; b=f8stpGLtMVcuwoK5/fENUxwpWkfArEJdcD3Ex68IkDm/SHXm83YjOoLUoIIde/DwQT5uvX 0ZKRex55UryGxcZ00vmqswOhA66ajNOjPpFY+O3+/LnMYDyCtpvwGVPpji1LBhYZKH14Pv vXQZt1Rz6ssIcAQ+V54DthklNhbhNxI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-299-ZUV0tDjFPYKGBRueXKV3Fw-1; Fri, 08 Mar 2024 09:31:20 -0500 X-MC-Unique: ZUV0tDjFPYKGBRueXKV3Fw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1E481185A783; Fri, 8 Mar 2024 14:31:20 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.194.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91E8337FC; Fri, 8 Mar 2024 14:31:00 +0000 (UTC) From: Kevin Traynor To: Kalesh AP Cc: Ajit Khaparde , Somnath Kotur , dpdk stable Subject: patch 'net/bnxt: fix null pointer dereference' has been queued to stable release 21.11.7 Date: Fri, 8 Mar 2024 14:27:59 +0000 Message-ID: <20240308142824.528417-11-ktraynor@redhat.com> In-Reply-To: <20240308142824.528417-1-ktraynor@redhat.com> References: <20240308142824.528417-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 Hi, FYI, your patch has been queued to stable release 21.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/13/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/1de0e75b7b71de87232e49939dc2da8e2aeb728c Thanks. Kevin --- >From 1de0e75b7b71de87232e49939dc2da8e2aeb728c Mon Sep 17 00:00:00 2001 From: Kalesh AP Date: Wed, 7 Feb 2024 01:19:02 -0800 Subject: [PATCH] net/bnxt: fix null pointer dereference [ upstream commit 68eeafdef4db7362ff5307995b670a98f65f2493 ] In the recent changes to rte_eth_dev_release_port() the library sets eth_dev->data to NULL at the end of the routine. This causes a NULL pointer dereference in the bnxt_rep_dev_info_get_op() and bnxt_representor_uninit() routines when it tries to validate parent dev. Add code to handle this. Fixes: 6dc83230b43b ("net/bnxt: support port representor data path") Signed-off-by: Kalesh AP Reviewed-by: Ajit Khaparde Reviewed-by: Somnath Kotur --- drivers/net/bnxt/bnxt_reps.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c index 5b2d9aee3a..ea3a1fab8e 100644 --- a/drivers/net/bnxt/bnxt_reps.c +++ b/drivers/net/bnxt/bnxt_reps.c @@ -33,4 +33,12 @@ static const struct eth_dev_ops bnxt_rep_dev_ops = { }; +static bool bnxt_rep_check_parent(struct bnxt_representor *rep) +{ + if (!rep->parent_dev->data->dev_private) + return false; + + return true; +} + uint16_t bnxt_vfr_recv(uint16_t port_id, uint16_t queue_id, struct rte_mbuf *mbuf) @@ -267,10 +275,10 @@ int bnxt_representor_uninit(struct rte_eth_dev *eth_dev) eth_dev->data->mac_addrs = NULL; - parent_bp = rep->parent_dev->data->dev_private; - if (!parent_bp) { + if (!bnxt_rep_check_parent(rep)) { PMD_DRV_LOG(DEBUG, "BNXT Port:%d already freed\n", eth_dev->data->port_id); return 0; } + parent_bp = rep->parent_dev->data->dev_private; parent_bp->num_reps--; @@ -541,9 +549,10 @@ int bnxt_rep_dev_info_get_op(struct rte_eth_dev *eth_dev, /* MAC Specifics */ - parent_bp = rep_bp->parent_dev->data->dev_private; - if (!parent_bp) { - PMD_DRV_LOG(ERR, "Rep parent NULL!\n"); + if (!bnxt_rep_check_parent(rep_bp)) { + /* Need not be an error scenario, if parent is closed first */ + PMD_DRV_LOG(INFO, "Rep parent port does not exist.\n"); return rc; } + parent_bp = rep_bp->parent_dev->data->dev_private; PMD_DRV_LOG(DEBUG, "Representor dev_info_get_op\n"); dev_info->max_mac_addrs = parent_bp->max_l2_ctx; -- 2.43.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-08 13:47:49.381208137 +0000 +++ 0011-net-bnxt-fix-null-pointer-dereference.patch 2024-03-08 13:47:48.997686601 +0000 @@ -1 +1 @@ -From 68eeafdef4db7362ff5307995b670a98f65f2493 Mon Sep 17 00:00:00 2001 +From 1de0e75b7b71de87232e49939dc2da8e2aeb728c Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 68eeafdef4db7362ff5307995b670a98f65f2493 ] + @@ -14 +15,0 @@ -Cc: stable@dpdk.org @@ -24 +25 @@ -index 3a4720bc3c..edcc27f556 100644 +index 5b2d9aee3a..ea3a1fab8e 100644 @@ -53 +54 @@ -@@ -540,9 +548,10 @@ int bnxt_rep_dev_info_get_op(struct rte_eth_dev *eth_dev, +@@ -541,9 +549,10 @@ int bnxt_rep_dev_info_get_op(struct rte_eth_dev *eth_dev,