Received: by 2002:ac8:156:0:b0:3e0:cd10:60c8 with SMTP id f22csp1792734qtg; Wed, 22 Mar 2023 02:05:07 -0700 (PDT) X-Google-Smtp-Source: AK7set+KUU+jZqun54qaijvbTo6otDmoWJy5BHR+cfSm0he++dCpk+QgSGf4VfF79W3Y1N/6WSXu X-Received: by 2002:a17:90a:53:b0:237:d2d8:3264 with SMTP id 19-20020a17090a005300b00237d2d83264mr2885703pjb.40.1679475907170; Wed, 22 Mar 2023 02:05:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679475907; cv=none; d=google.com; s=arc-20160816; b=QsLjApW+dBIsv72SIMXLRv3oW9IamUipr2XeZE2Xh3SOnbxtpX4Z7vT63n3SViODdH gAfTv/lQAR+Zor2RE8NDpOgxZ8beBsf9paS57e/gEMeiBuDFngoisXolW5sRBDgK7LOz cduvGTX2l/1OiQYXgJhacPjRlNMqBh9lN/C7yusxToRTrH6c3gG6/cEAz7jfo9oYpJJo DVgFf8qYitFk9ol5ldB6fmS8kQ/up8RuZJb0+63yaMdyahFPDOsulpiOKYJzVvZguL+a QkTuf+l7HkJvYePR7G7LOMD1Xc60NwxUBtXBf24oPcQKub4PDdIkvTVb9mYKuzfbJB32 +2ww== 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 :message-id:date:subject:cc:to:from; bh=5stZOgwyIw+4vYoUa3b+yfwg7lobd9LsbC+btd+rUQA=; b=irVK7bywPPys83sUN0S+81GfTZ/+1XGWid+O/tHsfPYgd4Uiqx9BDn9CqJCIz4j3Oe IxEG+ni2LwekMs2Uo/YRorsZG/4kG7vu3uwqDzgt75Ytp5ZW+XZPN++TURhMml0rlNZ9 Hw5NEARyIWTSf6RvlKkOcMNIRLho8WMdp3bdfLV4my2u0rzRXS1lyn9ZvLCtZI/pdzUk LEDAdGP7vWg5VfeB+fnWr+nM6dfQ/ER9baFoBQfjlQzyRVewkBlaRB0fg+qKRXGxEMWS lXhVJZJjMEd5qRDp9aoo5m91l2g6Ytek48QXscPb8qkVQkWXrAciW4VPL4JNcN65fcgd o+1g== 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 d5-20020a17090a8d8500b00233f394d0e8si20504965pjo.53.2023.03.22.02.04.55; Wed, 22 Mar 2023 02:05:07 -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 S229713AbjCVI7B (ORCPT + 99 others); Wed, 22 Mar 2023 04:59:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbjCVI7A (ORCPT ); Wed, 22 Mar 2023 04:59:00 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE9E54AFE7 for ; Wed, 22 Mar 2023 01:58:54 -0700 (PDT) X-UUID: adafd4d116cd41dfb51ecabed6ce9250-20230322 X-CID-O-RULE: Release_Ham X-CID-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.20,REQID:6f55a80e-d090-412f-94ec-3ae6d833094b,IP:5,U RL:0,TC:0,Content:0,EDM:25,RT:0,SF:-5,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:25 X-CID-INFO: VERSION:1.1.20,REQID:6f55a80e-d090-412f-94ec-3ae6d833094b,IP:5,URL :0,TC:0,Content:0,EDM:25,RT:0,SF:-5,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:25 X-CID-META: VersionHash:25b5999,CLOUDID:28df2229-564d-42d9-9875-7c868ee415ec,B ulkID:230322165700VFA7MY6F,BulkQuantity:1,Recheck:0,SF:38|24|17|19|44|102, TC:nil,Content:0,EDM:5,IP:-2,URL:0,File:nil,Bulk:40,QS:nil,BEC:nil,COL:0,O SI:0,OSA:0,AV:0 X-CID-BVR: 0,NGT X-UUID: adafd4d116cd41dfb51ecabed6ce9250-20230322 X-User: zhouzongmin@kylinos.cn Received: from thinkpadx13gen2i.. [(116.128.244.169)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 294111190; Wed, 22 Mar 2023 16:58:50 +0800 From: Zongmin Zhou To: airlied@redhat.com, kraxel@redhat.com, airlied@linux.ie, 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: [PATCH] drm/qxl: prevent memory leak Date: Wed, 22 Mar 2023 16:58:47 +0800 Message-Id: <20230322085847.3385930-1-zhouzongmin@kylinos.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable 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 No virus found Checked by Hillstone Network AntiVirus