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: 113081 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7663613vqr; Mon, 26 Jun 2023 11:09:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5oqqZfL/SvY7qhcMn9miQZXzZEEEAFgEPcn3w21zg/PCaMN4yUzPeE6dYjLmr64SNX/sSB X-Received: by 2002:a05:651c:8b:b0:2b5:8ff0:4134 with SMTP id 11-20020a05651c008b00b002b58ff04134mr8659173ljq.34.1687802951739; Mon, 26 Jun 2023 11:09:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687802951; cv=none; d=google.com; s=arc-20160816; b=AFIha97sERLIkRJ+hyccTbrLE2rbs0Q/lOP19roObhWKZNd+nn1kwRppua6MH4lY1b +Y4KLuHJYytJ92ickt21Le/Il1l4coOviX4OYkpPy8pPCehk0a3C5et9q9Uv9S7hmUji eCDwR2nYSlXW/yjbjvbz2qHvZOz+9uAIt0QPbG8AM8pRKkMrst07dpXO+hiyXwz7nAlq RONuhLmuMfyTbRo+5gucf6BTmNEfk4IE4r1a8rFijpIJ5tR2kria3MMRqHHsTlle7Ms+ s3dYaZEUE5VkBtC1vXU7REIod5nHlplt1KSmiWWVrKF727GtGq2bYvbz4hhF5CCVi8FA uDSQ== 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=BGGyOUjmeLF+AGKh6R3Y54C26QODabGB8VFixU/zQP4=; fh=96qtDnTU/URrOT6i7uaKTwabo9K0PbhXvr8DzFjxXtc=; b=jfiClg8lO3E5A1wRSTOsnJKpPVL037+3UniO+msgVQFuYXtcH2lbu7cfQKoqUwvGu7 AyjoMQnLdnejWBiw0o0lArLaATvIUMEvozwP7xcg4OJsuTHYFEe6vchssWxVAixd7dh7 NgW0KHxlt82qkgVvcJrOimRlyhrPKHIqpqKSDW0qvPtKNiyLk3swt5sNSCF4r3+qwqiy e+2YAgybvtc16H5jXqEjNfhvuLm7IecdIOT2a9SqB/QJ0v/y392vB2nfmQvKxrIKUP59 2kAP4weDnTz1iODPsu00e4F4Fui0OS/Bb0vwIsITIdwH4sOYzpB23TqcegUzWc0k4EyP biZg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n24-20020aa7c458000000b0051becc0dce7si3013748edr.691.2023.06.26.11.08.44; Mon, 26 Jun 2023 11:09:11 -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 S230487AbjFZR6K (ORCPT + 99 others); Mon, 26 Jun 2023 13:58:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229698AbjFZR6I (ORCPT ); Mon, 26 Jun 2023 13:58:08 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E6F5B130; Mon, 26 Jun 2023 10:58:06 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.43]) by gateway (Coremail) with SMTP id _____8AxS8at0Zlk54kCAA--.3882S3; Tue, 27 Jun 2023 01:58:05 +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 Cc: dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org 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: 1Uk129KBj9xXoWrtF4DXFWxKw1UCr1kJFW5Arc_yoWfXFb_ua 48ur97W34UCF1kCF1ayrW2yFWYk345Zr48XayqyF93K347ZFs3W34DuryruFyUGFsrG3Z8 JF9rXr4fZa1S9osvyTuYvTs0mTUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUj1kv1TuYvT s0mT0YCTnIWjqI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUI cSsGvfJTRUUUb78YFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20x vaj40_Wr0E3s1l1IIY67AEw4v_JrI_Jryl8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVWUJVWUCwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV WUJVW8JwA2z4x0Y4vEx4A2jsIE14v26r1j6r4UM28EF7xvwVC2z280aVCY1x0267AKxVW8 JVW8Jr1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27wAqx4 xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v2 6r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x0EwI xGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480 Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7 IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k2 6cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxV AFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU1EksDUUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769789668305039722?= X-GMAIL-MSGID: =?utf-8?q?1769789668305039722?= 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; }