From patchwork Mon Jun 26 17:58:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 13293294 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A341EB64D7 for ; Mon, 26 Jun 2023 17:58:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 12BEE10E204; Mon, 26 Jun 2023 17:58:11 +0000 (UTC) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by gabe.freedesktop.org (Postfix) with ESMTP id 409D310E204 for ; Mon, 26 Jun 2023 17:58:07 +0000 (UTC) Received: from loongson.cn (unknown [10.20.42.43]) by gateway (Coremail) with SMTP id _____8Dxc8St0Zlk5YkCAA--.4044S3; Tue, 27 Jun 2023 01:58:06 +0800 (CST) Received: from openarena.loongson.cn (unknown [10.20.42.43]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Dx4eSt0ZlkojAKAA--.44182S2; Tue, 27 Jun 2023 01:58:05 +0800 (CST) From: Sui Jingfeng To: Thierry Reding , Mikko Perttunen , David Airlie , Daniel Vetter , Jonathan Hunter Subject: [PATCH] drm/tegra: Fix potential memory leak if vmap() fail Date: Tue, 27 Jun 2023 01:58:05 +0800 Message-Id: <20230626175805.672589-1-suijingfeng@loongson.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Dx4eSt0ZlkojAKAA--.44182S2 X-CM-SenderInfo: xvxlyxpqjiv03j6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBj9xXoWrtF4DXFWxKw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6r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxU4R6wDUUUU X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The vmap function called in the tegra_fbdev_probe() function could fail, It doesn't matther. But if the error handling is necessary, it should also free the resources allocated by drm_fb_helper_alloc_info() function and the gem buffer object allocated by tegra_bo_create(). Signed-off-by: Sui Jingfeng --- drivers/gpu/drm/tegra/fbdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/tegra/fbdev.c b/drivers/gpu/drm/tegra/fbdev.c index e74d9be981c7..d2152b5eb77b 100644 --- a/drivers/gpu/drm/tegra/fbdev.c +++ b/drivers/gpu/drm/tegra/fbdev.c @@ -141,6 +141,8 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper, destroy: drm_framebuffer_remove(fb); + drm_fb_helper_release_info(helper); + drm_gem_object_put(&bo->gem); return err; }