[dpdk-stable] patch 'crypto/octeontx: fix freeing after device release' has been queued to stable release 19.11.10

christian.ehrhardt at canonical.com christian.ehrhardt at canonical.com
Tue Aug 10 17:40:20 CEST 2021


Hi,

FYI, your patch has been queued to stable release 19.11.10

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 08/12/21. 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/8bf13272693339b0f50f5c1b3ff69c3090f5b5a2

Thanks.

Christian Ehrhardt <christian.ehrhardt at canonical.com>

---
>From 8bf13272693339b0f50f5c1b3ff69c3090f5b5a2 Mon Sep 17 00:00:00 2001
From: Akhil Goyal <gakhil at marvell.com>
Date: Fri, 30 Jul 2021 23:28:27 +0530
Subject: [PATCH] crypto/octeontx: fix freeing after device release

[ upstream commit 12b650efd49d8b932a7717be1cafd13d9040ea3e ]

When the PMD is removed, rte_cryptodev_pmd_release_device
is called which frees cryptodev->data, and then tries to free
cryptodev->data->dev_private, which causes the heap use
after free issue.

A temporary pointer is set before the free of cryptodev->data,
which can then be used afterwards to free dev_private.

Fixes: bfe2ae495ee2 ("crypto/octeontx: add PMD skeleton")

Reported-by: Zhihong Peng <zhihongx.peng at intel.com>
Signed-off-by: Akhil Goyal <gakhil at marvell.com>
---
 drivers/crypto/octeontx/otx_cryptodev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/octeontx/otx_cryptodev.c b/drivers/crypto/octeontx/otx_cryptodev.c
index ddece13118..adc6c5c042 100644
--- a/drivers/crypto/octeontx/otx_cryptodev.c
+++ b/drivers/crypto/octeontx/otx_cryptodev.c
@@ -72,6 +72,7 @@ otx_cpt_pci_remove(struct rte_pci_device *pci_dev)
 {
 	struct rte_cryptodev *cryptodev;
 	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
+	void *dev_priv;
 
 	if (pci_dev == NULL)
 		return -EINVAL;
@@ -85,11 +86,13 @@ otx_cpt_pci_remove(struct rte_pci_device *pci_dev)
 	if (pci_dev->driver == NULL)
 		return -ENODEV;
 
+	dev_priv = cryptodev->data->dev_private;
+
 	/* free crypto device */
 	rte_cryptodev_pmd_release_device(cryptodev);
 
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
-		rte_free(cryptodev->data->dev_private);
+		rte_free(dev_priv);
 
 	cryptodev->device->driver = NULL;
 	cryptodev->device = NULL;
-- 
2.32.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-08-10 15:11:16.836756215 +0200
+++ 0100-crypto-octeontx-fix-freeing-after-device-release.patch	2021-08-10 15:11:13.130638908 +0200
@@ -1 +1 @@
-From 12b650efd49d8b932a7717be1cafd13d9040ea3e Mon Sep 17 00:00:00 2001
+From 8bf13272693339b0f50f5c1b3ff69c3090f5b5a2 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 12b650efd49d8b932a7717be1cafd13d9040ea3e ]
+
@@ -15 +16,0 @@
-Cc: stable at dpdk.org
@@ -24 +25 @@
-index 7207909abb..3822c0d779 100644
+index ddece13118..adc6c5c042 100644
@@ -27 +28 @@
-@@ -75,6 +75,7 @@ otx_cpt_pci_remove(struct rte_pci_device *pci_dev)
+@@ -72,6 +72,7 @@ otx_cpt_pci_remove(struct rte_pci_device *pci_dev)
@@ -35 +36 @@
-@@ -88,11 +89,13 @@ otx_cpt_pci_remove(struct rte_pci_device *pci_dev)
+@@ -85,11 +86,13 @@ otx_cpt_pci_remove(struct rte_pci_device *pci_dev)


More information about the stable mailing list