From patchwork Tue Nov 25 13:21:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oded Gabbay X-Patchwork-Id: 5379211 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 36DEA9F818 for ; Tue, 25 Nov 2014 13:22:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6F52A200F3 for ; Tue, 25 Nov 2014 13:22:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5922A201BB for ; Tue, 25 Nov 2014 13:22:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 990916E1D2; Tue, 25 Nov 2014 05:22:20 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0134.outbound.protection.outlook.com [157.56.110.134]) by gabe.freedesktop.org (Postfix) with ESMTP id 0F40E6E1D2 for ; Tue, 25 Nov 2014 05:22:18 -0800 (PST) Received: from BY2PR02CA0031.namprd02.prod.outlook.com (10.141.216.21) by BN1PR02MB198.namprd02.prod.outlook.com (10.242.214.151) with Microsoft SMTP Server (TLS) id 15.1.26.15; Tue, 25 Nov 2014 13:22:16 +0000 Received: from BL2FFO11FD007.protection.gbl (2a01:111:f400:7c09::199) by BY2PR02CA0031.outlook.office365.com (2a01:111:e400:2c40::21) with Microsoft SMTP Server (TLS) id 15.1.26.15 via Frontend Transport; Tue, 25 Nov 2014 13:22:14 +0000 Received: from atltwp02.amd.com (165.204.84.222) by BL2FFO11FD007.mail.protection.outlook.com (10.173.161.3) with Microsoft SMTP Server id 15.1.6.13 via Frontend Transport; Tue, 25 Nov 2014 13:22:13 +0000 X-WSS-ID: 0NFLJT0-08-9XN-02 X-M-MSG: Received: from satlvexedge01.amd.com (satlvexedge01.amd.com [10.177.96.28]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by atltwp02.amd.com (Axway MailGate 5.3.1) with ESMTPS id 23F1BD1600E for ; Tue, 25 Nov 2014 07:22:12 -0600 (CST) Received: from SATLEXDAG05.amd.com (10.181.40.11) by satlvexedge01.amd.com (10.177.96.28) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 25 Nov 2014 07:22:36 -0600 Received: from AMD (10.180.168.240) by satlexdag05.amd.com (10.181.40.11) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 25 Nov 2014 08:21:57 -0500 From: Oded Gabbay To: Subject: [PATCH] amdkfd: Fix memory leak of mqds on dqm fini Date: Tue, 25 Nov 2014 15:21:52 +0200 Message-ID: <1416921712-3589-1-git-send-email-oded.gabbay@amd.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.222; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(428002)(199003)(189002)(19580405001)(104166001)(50226001)(19580395003)(110136001)(64706001)(4396001)(46102003)(92726001)(92566001)(102836001)(99396003)(20776003)(50986999)(97736003)(120916001)(47776003)(33646002)(84676001)(44976005)(88136002)(87936001)(48376002)(101416001)(68736004)(89996001)(50466002)(31966008)(87286001)(229853001)(21056001)(106466001)(107046002)(2351001)(95666004)(105586002)(77156002)(77096003)(62966003)(450100001)(36756003)(93916002)(86362001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN1PR02MB198; H:atltwp02.amd.com; FPR:; SPF:None; MLV:sfv; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BN1PR02MB198; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:BN1PR02MB198; X-Forefront-PRVS: 040655413E Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Authentication-Results: spf=none (sender IP is 165.204.84.222) smtp.mailfrom=Oded.Gabbay@amd.com; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:BN1PR02MB198; X-OriginatorOrg: amd4.onmicrosoft.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The mqds array members are not freed when dqm is uninitialized. Signed-off-by: Oded Gabbay --- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index 904eb38..924e90c 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -575,11 +575,15 @@ static int initialize_nocpsch(struct device_queue_manager *dqm) static void uninitialize_nocpsch(struct device_queue_manager *dqm) { + int i; + BUG_ON(!dqm); BUG_ON(dqm->queue_count > 0 || dqm->processes_count > 0); kfree(dqm->allocated_queues); + for (i = 0 ; i < KFD_MQD_TYPE_MAX ; i++) + kfree(dqm->mqds[i]); mutex_destroy(&dqm->lock); kfd2kgd->free_mem(dqm->dev->kgd, (struct kgd_mem *) dqm->pipeline_mem);