From patchwork Thu Aug 24 10:52:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Duszynski X-Patchwork-Id: 130703 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C4F0E430EF; Thu, 24 Aug 2023 12:52:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4AF1340EE1; Thu, 24 Aug 2023 12:52:37 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id B86DC40150 for ; Thu, 24 Aug 2023 12:52:35 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37O75l2l001835; Thu, 24 Aug 2023 03:52:34 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=gFuza5Cm/xRYD2epYRTHsfaAGUTLIfFhhl8rIUDXEvU=; b=hqspxDvHmFA9o5niUfEhdSfuwNePz+foyAZinMyw4YRNK2gNJS18SVJELXc+/byyXvR6 L8gJ3/uCA9dv6E3CZiZ2BbuuMLRhJBwXjmgGbtHvX3yFVfRkRMfA+uFmUx3jOs0hGCuL 0eis00BAKPybiohETJ+JDuaMeMbvs+EXU7BUs5cnMaDX7mDFYjrQwTBiLRbZafMhLsLb fzPU48Kvca/ELbG4wV5vHCZCqdF/YAYlONXvCWP5PeMl93MoP+u7KayTrzVbZKXSDzGa d4s9jFXR83oVCjGmaLj8dkH4oGhHsdMTSPvJkDg3pk7a02qZ20kMQyaby+KBJHr1ipxH Jw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3sn20cy25m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 24 Aug 2023 03:52:34 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 24 Aug 2023 03:52:32 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 24 Aug 2023 03:52:32 -0700 Received: from cavium-DT10.. (unknown [10.28.34.39]) by maili.marvell.com (Postfix) with ESMTP id D73873F705D; Thu, 24 Aug 2023 03:52:30 -0700 (PDT) From: Tomasz Duszynski To: , Tomasz Duszynski CC: , Subject: [PATCH] bus/platform: fix use after free Date: Thu, 24 Aug 2023 12:52:25 +0200 Message-ID: <20230824105225.822297-1-tduszynski@marvell.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Proofpoint-GUID: i_trWOZmXjIYV5jKuQaV3TDsccfXUIor X-Proofpoint-ORIG-GUID: i_trWOZmXjIYV5jKuQaV3TDsccfXUIor X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-24_07,2023-08-24_01,2023-05-22_02 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Remove device from the list before doing actual cleanup to avoid use after free. Bugzilla ID: 1276 Fixes: 17c839f74da3 ("bus: add platform bus") Signed-off-by: Tomasz Duszynski --- drivers/bus/platform/platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c index 9b6ed2832e..7e24bb96a1 100644 --- a/drivers/bus/platform/platform.c +++ b/drivers/bus/platform/platform.c @@ -617,8 +617,8 @@ platform_bus_cleanup(void) struct rte_platform_device *pdev, *tmp; RTE_TAILQ_FOREACH_SAFE(pdev, &platform_bus.device_list, next, tmp) { - platform_bus_unplug(&pdev->device); TAILQ_REMOVE(&platform_bus.device_list, pdev, next); + platform_bus_unplug(&pdev->device); } return 0;