Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2025822pxa; Mon, 3 Aug 2020 05:43:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2DcX38VJ7bIe6lNlF9pOG39G8JtwwM/d1tRSzUgz4/cgzhvAdh+WrY3usx1HA2pgXsPVM X-Received: by 2002:aa7:cd6c:: with SMTP id ca12mr164247edb.365.1596458592752; Mon, 03 Aug 2020 05:43:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596458592; cv=none; d=google.com; s=arc-20160816; b=H7WoA1354NY53ZH7TS0ze5yFmWb6EX/6+tYOV/7+RgaqMHb1iNVzFiaiL6/OxVHO3H P2KAkh6+u7QK7frqmpWZBSGcjoF+65fjmyUQQSq6KGzS3Dunz/61Bf8gwTHTdmo020EM kf1zf3o/RZXfOlmZxktNDlqagIQi+ty2NjScCjVUyIs7u/OzoxRkW3WEN5k7RW52BC61 OHmQzAQqOvdywzLQraQUU4Qj+Dt9z9cW3FrejPTRPa+nchsPZEps+7X0IxlJT3fbE9Yg o3A5ZNX5EUyaiZAjVVHT03CMmj77HNOQd1WjnqPMhytcX+J0KgbQcYuSP3p/gsNnys6/ yTXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6Bj8td2wttQxKgzppZWMvr44vOl0AKDeG9DGpwKd2Po=; b=ID0giRYJWgIRQHOumkf4HLvzVGL76wo17z8+Z1Zm8a6BzyBDsTZ2Rd3je3l6kk0U4E 5eOHFKshBmt9QmztiNZluU4HPjlakF1PzO88Kl8qWXzsu1rtdbFIkpdnLPDm7KD/Wz6d /Su3+3I3MFg+rVLz7XvWWRdJhOD8oF2/a7CdXTpzuhVaXcVL15FKrX8mb88m6K7oUTEh zcoMyZzZYDp6RpMqJpzzSJ8eXx7yW/XNTIBCscXh7kPHHObOAZF+6l0HsDUnA47cmVRw tR3J9XckFdEn5kMqw77KS8iJD1ZfnkOG5749TRxqyoGMCHf4XdcrQokSViRrw7FG7qho md8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UGZKiilT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r3si3206562eja.548.2020.08.03.05.42.50; Mon, 03 Aug 2020 05:43:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UGZKiilT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729250AbgHCMb5 (ORCPT + 99 others); Mon, 3 Aug 2020 08:31:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:59686 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729229AbgHCMby (ORCPT ); Mon, 3 Aug 2020 08:31:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5B81F2076B; Mon, 3 Aug 2020 12:31:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596457913; bh=vU4+VOH5vhPw1PXmzy6dPFNnUjCipOoP9pslkWrjUCI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UGZKiilTbwBUf4r7jeUIB0jmFo8Cwb2VefdjXPVocxc4no9LIjbMv7Jsb7L8JIHsx DlgHXmuQnH26fY3Bxm3dhP19YKfpSHDiHYPEYnwwqnCL71PDPPKlKeJumK9D0S/wWF Vr0A1oIAuK0FpKyTDzRn6K5bYOTAHWlyf/tGN2lg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harry Wentland , Navid Emamdoost , Alex Deucher , Sasha Levin Subject: [PATCH 4.19 08/56] drm/amd/display: prevent memory leak Date: Mon, 3 Aug 2020 14:19:23 +0200 Message-Id: <20200803121850.717314936@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200803121850.306734207@linuxfoundation.org> References: <20200803121850.306734207@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Navid Emamdoost [ Upstream commit 104c307147ad379617472dd91a5bcb368d72bd6d ] In dcn*_create_resource_pool the allocated memory should be released if construct pool fails. Reviewed-by: Harry Wentland Signed-off-by: Navid Emamdoost Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c | 1 + drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c | 1 + drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c | 1 + drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c | 1 + drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 1 + 5 files changed, 5 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c index 3f76e6019546f..5a2f29bd35082 100644 --- a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c @@ -1001,6 +1001,7 @@ struct resource_pool *dce100_create_resource_pool( if (construct(num_virtual_links, dc, pool)) return &pool->base; + kfree(pool); BREAK_TO_DEBUGGER(); return NULL; } diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c index e5e9e92521e91..17d936c260d97 100644 --- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c @@ -1344,6 +1344,7 @@ struct resource_pool *dce110_create_resource_pool( if (construct(num_virtual_links, dc, pool, asic_id)) return &pool->base; + kfree(pool); BREAK_TO_DEBUGGER(); return NULL; } diff --git a/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c b/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c index 288129343c778..71adab8bf31b1 100644 --- a/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c @@ -1287,6 +1287,7 @@ struct resource_pool *dce112_create_resource_pool( if (construct(num_virtual_links, dc, pool)) return &pool->base; + kfree(pool); BREAK_TO_DEBUGGER(); return NULL; } diff --git a/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c b/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c index d43f37d99c7d9..f0f2ce6da8278 100644 --- a/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c @@ -1076,6 +1076,7 @@ struct resource_pool *dce120_create_resource_pool( if (construct(num_virtual_links, dc, pool)) return &pool->base; + kfree(pool); BREAK_TO_DEBUGGER(); return NULL; } diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c index 6b44ed3697a4f..e6d5568811400 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c @@ -1361,6 +1361,7 @@ struct resource_pool *dcn10_create_resource_pool( if (construct(num_virtual_links, dc, pool)) return &pool->base; + kfree(pool); BREAK_TO_DEBUGGER(); return NULL; } -- 2.25.1