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 7F17BA0C41 for ; Tue, 30 Nov 2021 17:42:30 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 73828410F7; Tue, 30 Nov 2021 17:42:30 +0100 (CET) Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by mails.dpdk.org (Postfix) with ESMTP id 8776A41177 for ; Tue, 30 Nov 2021 17:42:28 +0100 (CET) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (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 smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 61A9D3F1B2 for ; Tue, 30 Nov 2021 16:42:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1638290548; bh=vR4L3YgznzTkR36fatxe7aAl9L5kCE7kBmtECExZ73M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KTQ6Kj7S+h1SzTpe+FtRKOWPwcEu2ZiAuzr8wpZ//kKaqmqYwgTWhzF3FwotrWwOG OWiKyQkcZ2+i21dJzq3obtg4w9or59IHjaoPA0l92Au35+Xbb9Gpgtcc94AT4xGsCf gVFirE1X2Oh4nuAaEK68QCSrXHTvtO0J8LLlwgccIeLTELwAkuLSl3/fPkAqoqY1oi e26Bk0AUL6W/uZhYf7jqqbaYiBRh63c+s66ShXckBsW+L937pMUfkNQxITO2u7DucO XVbGT2hAuPn/eaujNmtWJ3PVf2BikE8gRMPmsjxV9sbzCzpOhYWm6NXoYWZYI3Z5o4 KVVcHtxI73PrQ== Received: by mail-ed1-f69.google.com with SMTP id l15-20020a056402124f00b003e57269ab87so17435576edw.6 for ; Tue, 30 Nov 2021 08:42:28 -0800 (PST) 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=vR4L3YgznzTkR36fatxe7aAl9L5kCE7kBmtECExZ73M=; b=QnSLJ0eEcJtkObwlTO5e0qJEl6bFH67hoo0gRY6fw1aiWpyCZdggxuq5/QVyWIIseC VTizxJzGEs5Nx1SXfjejJO5mpqFsM0a7bzyRh0UjvyYsihgrwhq2iYRPSABzn/3q3yx/ Y1O1/lpcefogoJGpODDRIc+5w7Ek3jN4mi/heQ6oFU5WgUheUpxNwWzELk/BV0X9yG3c MA59TivBJlAX57SwSRf2V7tCY/YIcdG6cteiYcX4xsQI6Crrtde1ZyINerGMLmMIOFyF AXoZOVv3ZCNU0iyoZYvFpUozhyHmVaMKCSrdLhAL96I2ajwOFzMh+TcXIxII7XvR1yR3 lllA== X-Gm-Message-State: AOAM530NqJRt8Hvt6l0jPmxUBAYpDiou2gNkYwStVZ9cR7KOz4MAU6n2 16DyyGAzDtI/nCYopz6+9OF7eh+3FdrcCqcVeO2u5dzdkbjQ+iAGR7otuBRrEEPk7t++XIJtxSG Dskj7oRm0CQHJOus9CateCXyx X-Received: by 2002:a17:906:c152:: with SMTP id dp18mr196025ejc.241.1638290548032; Tue, 30 Nov 2021 08:42:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxx84k1YceR4T8kvcxOReHZIW8nbtqIU0gp4dupKNvdYSBUs3NK98naNC2rOgZxrfTVIJHhRg== X-Received: by 2002:a17:906:c152:: with SMTP id dp18mr196008ejc.241.1638290547897; Tue, 30 Nov 2021 08:42:27 -0800 (PST) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c4ad]) by smtp.gmail.com with ESMTPSA id r25sm11515299edt.21.2021.11.30.08.42.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Nov 2021 08:42:27 -0800 (PST) From: christian.ehrhardt@canonical.com To: Ferruh Yigit Cc: Chenbo Xia , Thomas Monjalon , Andrew Rybchenko , dpdk stable Subject: patch 'ethdev: fix crash on owner delete' has been queued to stable release 19.11.11 Date: Tue, 30 Nov 2021 17:35:26 +0100 Message-Id: <20211130163605.2460997-122-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211130163605.2460997-1-christian.ehrhardt@canonical.com> References: <20211130163605.2460997-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 19.11.11 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before December 10th 2021. 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/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/d3ccaea9fd142fe5fd42523ba9e79148319cb9db Thanks. Christian Ehrhardt --- >From d3ccaea9fd142fe5fd42523ba9e79148319cb9db Mon Sep 17 00:00:00 2001 From: Ferruh Yigit Date: Thu, 4 Nov 2021 11:04:21 +0000 Subject: [PATCH] ethdev: fix crash on owner delete [ upstream commit b7ade5d31a747fc044a9816b38814b47a6e1b201 ] 'eth_dev->data' can be null before ethdev allocated. The API walks through all eth devices, at least for some data can be null. Adding 'eth_dev->data' null check before accessing it. Fixes: 33c73aae32e4 ("ethdev: allow ownership operations on unused port") Signed-off-by: Ferruh Yigit Acked-by: Chenbo Xia Acked-by: Thomas Monjalon Acked-by: Andrew Rybchenko --- lib/librte_ethdev/rte_ethdev.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index a51a902f04..abcc31c19e 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -702,10 +702,13 @@ rte_eth_dev_owner_delete(const uint64_t owner_id) rte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock); if (rte_eth_is_valid_owner_id(owner_id)) { - for (port_id = 0; port_id < RTE_MAX_ETHPORTS; port_id++) - if (rte_eth_devices[port_id].data->owner.id == owner_id) - memset(&rte_eth_devices[port_id].data->owner, 0, + for (port_id = 0; port_id < RTE_MAX_ETHPORTS; port_id++) { + struct rte_eth_dev_data *data = + rte_eth_devices[port_id].data; + if (data != NULL && data->owner.id == owner_id) + memset(&data->owner, 0, sizeof(struct rte_eth_dev_owner)); + } RTE_ETHDEV_LOG(NOTICE, "All port owners owned by %016"PRIx64" identifier have removed\n", owner_id); -- 2.34.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-30 16:50:13.088309076 +0100 +++ 0122-ethdev-fix-crash-on-owner-delete.patch 2021-11-30 16:50:05.950874704 +0100 @@ -1 +1 @@ -From b7ade5d31a747fc044a9816b38814b47a6e1b201 Mon Sep 17 00:00:00 2001 +From d3ccaea9fd142fe5fd42523ba9e79148319cb9db Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit b7ade5d31a747fc044a9816b38814b47a6e1b201 ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -19 +20 @@ - lib/ethdev/rte_ethdev.c | 9 ++++++--- + lib/librte_ethdev/rte_ethdev.c | 9 ++++++--- @@ -22,6 +23,6 @@ -diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c -index 7db84b12d0..8e679e4003 100644 ---- a/lib/ethdev/rte_ethdev.c -+++ b/lib/ethdev/rte_ethdev.c -@@ -757,10 +757,13 @@ rte_eth_dev_owner_delete(const uint64_t owner_id) - rte_spinlock_lock(ð_dev_shared_data->ownership_lock); +diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c +index a51a902f04..abcc31c19e 100644 +--- a/lib/librte_ethdev/rte_ethdev.c ++++ b/lib/librte_ethdev/rte_ethdev.c +@@ -702,10 +702,13 @@ rte_eth_dev_owner_delete(const uint64_t owner_id) + rte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock); @@ -29 +30 @@ - if (eth_is_valid_owner_id(owner_id)) { + if (rte_eth_is_valid_owner_id(owner_id)) {