Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4448680rwl; Mon, 10 Apr 2023 11:09:54 -0700 (PDT) X-Google-Smtp-Source: AKy350YlC5FVaSBIj900TqJMHlGLH8kLUGpNg8t/quhs+5EmV4/n/EoMYhU8GlsEPOh1MNVeQfQ/ X-Received: by 2002:a17:906:916:b0:946:c022:8979 with SMTP id i22-20020a170906091600b00946c0228979mr7289559ejd.21.1681150194023; Mon, 10 Apr 2023 11:09:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681150194; cv=none; d=google.com; s=arc-20160816; b=Ryf/g+wbyd2PtmHpkpW3971/gJrAYN2wF0UMbsyy4KRkj6z+dBAScqhOy1VuuUn3ho 7ivCVG57gBczLoNOjyVHz7zZjtq7wOHPDJwgPlYLoTnEDNzq7f9fMDXHC9VCCsN0FyRB XhvkZywgFQjRiiaS4FsxFUS8XZWG4pxyZui034oqojVI/QScEoqvHhvCKdEAamrTL9br FrnsVhST6sJOeOCT9/WxLyMg3M9Zfs+iirPf0bHxwELwTri3XtIdVBmOWoowGMnPnZWV 3yTcL0v82XYmvQLCTiGRcNpYDJkwquzqiCjLnZWjse3VKayYWXEEQS9fgjPhIwjGSLLJ MGmQ== 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=zuyX6EynfLnuv9j7jlLRncrh31AclwvR4y+M5LRLnUc=; b=TvvIcEJkHCm215Vy8mCTmw7hNPhoMXJREREATn5R8FhwVXQSjvedm+n7vdr8gqgIgY pJp1jiN8Y2WVkPT2q58/PgUCMSai0ieJAh6IpUKPcGddspF/r6O3/Sr7zo9SjIbhu5Oa 4Hp2nMrpKmRnlfIDejGoB/5TgcHlRlEXXFyik9l3F7shVvsnG4dXpANWuhOamfwMLnO4 ghQjsx9FOAC29d5DAtk6LZrXFNNSswrUi8+dpU5aaLVwRn/iRXFNK4b/7iENVlv3KN+W jUBkTzj4LRdePmG/wvxYuAUMwx2EREaNO48dLN2JND1J5yjnJUu1Wfkv3ope0EyGFFD2 aHeQ== 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 ty26-20020a170907c71a00b0094a5a4b6598si4102058ejc.473.2023.04.10.11.09.29; Mon, 10 Apr 2023 11:09:54 -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 S230425AbjDJSG2 (ORCPT + 99 others); Mon, 10 Apr 2023 14:06:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230033AbjDJSGZ (ORCPT ); Mon, 10 Apr 2023 14:06:25 -0400 Received: from hust.edu.cn (unknown [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A10DB1BD6 for ; Mon, 10 Apr 2023 11:06:11 -0700 (PDT) Received: from liber-MS-7D42.. ([10.12.190.56]) (user=gangecen@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 33AI4Qur017616-33AI4Qus017616 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 11 Apr 2023 02:04:31 +0800 From: Gencen Gan To: Emma Anholt , David Airlie , Daniel Vetter , Gan Gecen Cc: hust-os-kernel-patches@googlegroups.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/pl111: fix drm and dev leak when irq request failed. Date: Tue, 11 Apr 2023 02:03:07 +0800 Message-Id: <20230410180307.3563501-1-gangecen@hust.edu.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-FEAS-AUTH-USER: gangecen@hust.edu.cn X-Spam-Status: No, score=-0.0 required=5.0 tests=SPF_HELO_PASS,SPF_PASS 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 From: Gan Gecen Smatch reports: pl111_amba_probe() warn: missing unwind goto? Code segment for dev_put is: dev_put: drm_dev_put(drm); of_reserved_mem_device_release(dev); When err happened, jumping to dev_put will release drm and dev resources allocated or initialized before. But after devm_request_irq() failed, it returns directly without releasing drm and dev, which may cause memory leak. Fixes: 3f9d6bccff6c ("drm/pl111: fix drm and dev leak when irq request failed") Signed-off-by: Gan Gecen --- drivers/gpu/drm/pl111/pl111_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c index 00deba0b7271..52945f7e0aef 100644 --- a/drivers/gpu/drm/pl111/pl111_drv.c +++ b/drivers/gpu/drm/pl111/pl111_drv.c @@ -297,7 +297,7 @@ static int pl111_amba_probe(struct amba_device *amba_dev, variant->name, priv); if (ret != 0) { dev_err(dev, "%s failed irq %d\n", __func__, ret); - return ret; + goto dev_put; } ret = pl111_modeset_init(drm); -- 2.34.1