From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (NAM02-BN1-obe.outbound.protection.outlook.com [40.107.212.88]) by mx.groups.io with SMTP id smtpd.web10.15036.1670679012462857420 for ; Sat, 10 Dec 2022 05:30:12 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=GfM+Velo; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.212.88, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NVFEHfDIvMbgtGLd2TaFa/y/5sAy9BO+cKb2WJKpuvkMDjZXamk9eB9NNJdWibx2Hq3xkZHrCD1iUKfm+IWtmG6wkBLKmSgKRr5Lp1Y9jBcR6C2gwVpZ8fC0v4YYqRFngW2Ph2xEmBSsexbFhQSrkOklzt67ms9l8s3RfBXdD6kguoyi9Qu5unpgSCtVnhjsc4dvqnUBE0JSMLO/LR98Njrubod7fW99gUsJvjApW7AR5rOcslyasQt0HwD9unIJ0jSIY9DZjScEQ4cs5CbqYtwXVhl5v+7Lr0AJff2o7el3vinXJszQsKZvq5Mn+XZ8FqrHFLEIjMwLzHrFAkWHpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=L+9OaxKEtu/iDEKB6oBtS4Dr9mrtpJ0v3iU8OXmXu0I=; b=fKOa513rhuQPlqiKPOUQrTQyDDpH6yRu5SuZ0AecVjpqkZ7P3+WIlIsrB6TkQ8yWuSJ0ulHNdEa7n7+uVyiXeJySfYJyhDFjP6ft1iC2Znck55WigYMxIowHEVydUDU071CjySYL2s7AX4njMx227RjGLO+0zYXOWiLr+FzFSlLOKbqNBC9l6RlA5+27/V1cK0iFqa+v3w0ZTjP7r6oK00m/a6yBnnrbTrinV6xhCZ70ZejQ3EUO/evWFdJ9/def2wLuq61DB6UtcjQFo50c3Wyx82y8DoFWNN097IfIymWUx8dN/YXU3vVIbUCrO5YEz30fDMURyyfA7y0zBLU4uw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L+9OaxKEtu/iDEKB6oBtS4Dr9mrtpJ0v3iU8OXmXu0I=; b=GfM+Velo7medDCBX/jw3Eit8JXIhpGkx/F+vU855+3Rr9VXLYjnoiAGsGjVp7Oyl3RPSQSq3qdYePIzeHEt1RwcWZe2RKLCE0n97jt0VA36HQOyKbuqmVOd8AfUwcddH5g2g10aMJFVAGQ4w1zGNUrW2NYCa4/5Tqll174fkBvk= Received: from BN9PR03CA0298.namprd03.prod.outlook.com (2603:10b6:408:f5::33) by IA0PR12MB7625.namprd12.prod.outlook.com (2603:10b6:208:439::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Sat, 10 Dec 2022 13:30:09 +0000 Received: from BN8NAM11FT030.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f5:cafe::28) by BN9PR03CA0298.outlook.office365.com (2603:10b6:408:f5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.19 via Frontend Transport; Sat, 10 Dec 2022 13:30:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT030.mail.protection.outlook.com (10.13.177.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5901.17 via Frontend Transport; Sat, 10 Dec 2022 13:30:09 +0000 Received: from TPE-L1-ABNCHANG.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Sat, 10 Dec 2022 07:30:06 -0600 From: "Chang, Abner" To: CC: , Hao A Wu , Ray Ni , Garrett Kirkendall , "Abner Chang" Subject: [PATCH] MdeModulePkg/XhciPei: Unlinked XhciPei memory block Date: Sat, 10 Dec 2022 21:29:42 +0800 Message-ID: <20221210132942.336-1-abner.chang@amd.com> X-Mailer: git-send-email 2.37.1.windows.1 MIME-Version: 1.0 Return-Path: Abner.Chang@amd.com X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT030:EE_|IA0PR12MB7625:EE_ X-MS-Office365-Filtering-Correlation-Id: 8e582283-ae5b-4298-8384-08dadab2a86e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vSco7fvx5l8PbwcWgSo+VocrEvif9T9nm1h3pnqns7H6W5qXimPqO6OUBQ1v/pYd+iv0sIpE/nwzd7NLhkHd4ljb6DF9QVo3KqFxYxF4+EvDobZV2+3HZyyFcZBHc47pCw5tYmVq08Qyfb4BUo9MzTvYWXCEdwJx/qcVdKHOpRWBhL/S0gmscdtsoPlfKWwOQyvPUdryek2LPmsvFZ/O29pH7ac0UGTeROuW96fgU3Lgxy+yzxizZUHTX06K46icDOZWBVyhB2W7kXQZrWpR/8S6FSuAaku8dVwk8wqVFp2layk1zYWNuxqplMtDQ5R50KYRtwaj1Sj18Sla1++lgdKNPc889ug9N8YjMegzcTnQP+6kwtkYbnKfRYnn13c3GjP1A7nGv56BFru8raEVJOg888Cdk+jn9/apRIqkBe55eLGh+jc7BfO7uRcWFXc2B+4q49B0lZqL3SnIQOgIQ9IPHj8mFS2isRXhjy+LuZo7fzNCdca38DezSYQaWxo2tui/pDA+k5/AJiMDt996l56b5DS/0mXbVNDgeBur/6spMojIzARVJZpHrFspwEtJDi5ylrcCFaQvkF3OferSqpXrCbzUlP1cGtL8GIg+qZeA2ZjlFfwugAwdRZ5DMK+bWABi+ZuEb/QgqKwvcJJqnGes5v8AX1ogkFgFn/LyfHu99qjBdOxhafDXRAMZEMeOQMDFEgtINw9/SPp9UCbOETS1m8LN+vyAyvpJXJ8COHs= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(376002)(136003)(396003)(39860400002)(346002)(451199015)(40470700004)(36840700001)(46966006)(26005)(82310400005)(5660300002)(47076005)(186003)(36756003)(6666004)(7696005)(82740400003)(6916009)(478600001)(16526019)(8676002)(2906002)(86362001)(70206006)(316002)(54906003)(70586007)(4326008)(40460700003)(36860700001)(41300700001)(2616005)(8936002)(40480700001)(1076003)(426003)(2876002)(356005)(83380400001)(81166007)(336012)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Dec 2022 13:30:09.0726 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8e582283-ae5b-4298-8384-08dadab2a86e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT030.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7625 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Abner Chang Unlink the XhciPei memory block when it has been freed. Signed-off-by: Kuei-Hung Lin Cc: Hao A Wu Cc: Ray Ni Cc: Garrett Kirkendall Cc: Abner Chang --- MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c | 28 ++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c b/MdeModulePkg/Bus/Pci= /XhciPei/UsbHcMem.c index c64b38fcfc8..41436dedf91 100644 --- a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c +++ b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c @@ -365,6 +365,32 @@ UsbHcInitMemPool ( return Pool; } =20 +/** + Unlink the memory block from the pool's list. + + @param Head The block list head of the memory's pool. + @param BlockToUnlink The memory block to unlink. + +**/ +VOID +UsbHcUnlinkMemBlock ( + IN USBHC_MEM_BLOCK *Head, + IN USBHC_MEM_BLOCK *BlockToUnlink + ) +{ + USBHC_MEM_BLOCK *Block; + + ASSERT ((Head !=3D NULL) && (BlockToUnlink !=3D NULL)); + + for (Block =3D Head; Block !=3D NULL; Block =3D Block->Next) { + if (Block->Next =3D=3D BlockToUnlink) { + Block->Next =3D BlockToUnlink->Next; + BlockToUnlink->Next =3D NULL; + break; + } + } +} + /** Release the memory management pool. =20 @@ -386,8 +412,8 @@ UsbHcFreeMemPool ( // first block. // for (Block =3D Pool->Head->Next; Block !=3D NULL; Block =3D Pool->Head->= Next) { - // UsbHcUnlinkMemBlock (Pool->Head, Block); UsbHcFreeMemBlock (Pool, Block); + UsbHcUnlinkMemBlock (Pool->Head, Block); } =20 UsbHcFreeMemBlock (Pool, Pool->Head); --=20 2.37.1.windows.1