Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5297488rwb; Mon, 31 Jul 2023 23:29:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlGAzMi2ilUWDBlrrIWNWa6AXlmK0YFiLNv3IMTD/ov8KMTv1LU7ykVcvyX9b5DcZ+PWTAU4 X-Received: by 2002:a17:906:300a:b0:992:c8d7:b66f with SMTP id 10-20020a170906300a00b00992c8d7b66fmr1584099ejz.75.1690871358058; Mon, 31 Jul 2023 23:29:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690871358; cv=none; d=google.com; s=arc-20160816; b=g6HGoRIoXJ7GqStxhiZJFGY8yOn9w9AlWTBrEelvTgtH4oEy5fD2TLol8BNOeivv9d 0gFw0n9UZNm5g3l2J0XwRil/u4HthBUKUszAtQK1dFCzNS6HuAPst8NSXrOlogRoIUGm xqSlboEMXCoe9Vsdrkg9vP1KR5OtUlwGQthjc7UfXM53vbxEknoNlel2xdSNnwuMChc/ WSjvcrT4c63EemP7Ho97FxzapX93BIHe1b4dQpWTK54NbZT85om1LceEC+5KiWCU3jde r+aID9JGJx2FNrMufKaQhcbuKHUwzEMmsgsxVVQvDymWR9GHzCCvttrsAAEk7pd4tI0T m0eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=uW2DOdRJQu9z7IDWZ3G34EALjY21hdlOnu7fQXNZZ5w=; fh=cdjpyAaiSekp8swcciS3O3Rj15/YU3sd6gAS9f/GBi4=; b=vDZvJz95cq22o3znx00DnVUlMU8LIe5Gl7IYXmNw4kEd90hXsxNgGbbJjNiL16ZqFu /Xqbr8s8y9NHug5KneOtBWvz/BzgICqdLWMEjqEYIrXr8OevKEgHWzKdN953zaYEIA6N RtLAAGtk3z0HdZ8xuJzvcfTP7nan/bevmXUmUY+iZM9FjWhNyOMWDZNDg0axpG7ZxD1+ RszCJelfCzOnCc9lkvWZ+remrji3Z70xj4d62zKpBr7FA3OErggXE4BTW+EvHultVXn/ i5yGQt/nir8bBzG9dfQw5vukKgUU+vmmcMD2Uz2Rhdm+mMg43UxRTX0YDp6WdQCS1YmY Hcqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qq7-20020a17090720c700b00997dbbda750si8595979ejb.839.2023.07.31.23.28.53; Mon, 31 Jul 2023 23:29:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230339AbjHACx3 (ORCPT + 99 others); Mon, 31 Jul 2023 22:53:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230229AbjHACx1 (ORCPT ); Mon, 31 Jul 2023 22:53:27 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED955173B for ; Mon, 31 Jul 2023 19:53:24 -0700 (PDT) X-UUID: eac41c770e474558b078cdeaa3e4ec1b-20230801 X-CID-O-RULE: Release_Ham X-CID-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.28,REQID:eacacd6f-0419-4e3f-8a56-feae8cc10ea2,IP:15, URL:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-INFO: VERSION:1.1.28,REQID:eacacd6f-0419-4e3f-8a56-feae8cc10ea2,IP:15,UR L:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:0 X-CID-META: VersionHash:176cd25,CLOUDID:37c58ad2-cd77-4e67-bbfd-aa4eaace762f,B ulkID:230801105315WRTL5TH5,BulkQuantity:0,Recheck:0,SF:38|24|17|19|44|102, TC:nil,Content:0,EDM:-3,IP:-2,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI X-UUID: eac41c770e474558b078cdeaa3e4ec1b-20230801 X-User: zhouzongmin@kylinos.cn Received: from thinkpadx13gen2i.. [(111.48.58.12)] by mailgw (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 2053895444; Tue, 01 Aug 2023 10:53:14 +0800 From: Zongmin Zhou To: airlied@redhat.com, kraxel@redhat.com, airlied@gmail.com, daniel@ffwll.ch Cc: virtualization@lists.linux-foundation.org, spice-devel@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Zongmin Zhou Subject: [RESEND PATCH] drm/qxl: prevent memory leak Date: Tue, 1 Aug 2023 10:53:09 +0800 Message-Id: <20230801025309.4049813-1-zhouzongmin@kylinos.cn> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230425014543.3448839-1-zhouzongmin@kylinos.cn> References: <20230425014543.3448839-1-zhouzongmin@kylinos.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The allocated memory for qdev->dumb_heads should be released in qxl_destroy_monitors_object before qxl suspend. otherwise,qxl_create_monitors_object will be called to reallocate memory for qdev->dumb_heads after qxl resume, it will cause memory leak. Signed-off-by: Zongmin Zhou --- drivers/gpu/drm/qxl/qxl_display.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c index 6492a70e3c39..404b0483bb7c 100644 --- a/drivers/gpu/drm/qxl/qxl_display.c +++ b/drivers/gpu/drm/qxl/qxl_display.c @@ -1229,6 +1229,9 @@ int qxl_destroy_monitors_object(struct qxl_device *qdev) if (!qdev->monitors_config_bo) return 0; + kfree(qdev->dumb_heads); + qdev->dumb_heads = NULL; + qdev->monitors_config = NULL; qdev->ram_header->monitors_config = 0; -- 2.34.1