Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2169419iof; Tue, 7 Jun 2022 22:03:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkdhI6tZUv96C30tkpD7hdOZnewYVrzZkycNJvnc0tp0Qk0FTRrZ/wjOzvAyfTwc6ioyQZ X-Received: by 2002:a17:902:be12:b0:167:6cbd:f113 with SMTP id r18-20020a170902be1200b001676cbdf113mr18238639pls.69.1654664583335; Tue, 07 Jun 2022 22:03:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654664583; cv=none; d=google.com; s=arc-20160816; b=mjClCAFZ1yiYJKZwFXx79SIQKq+lvLNiCsvM4icTP6DJAoLSKrYRtdYiqK5UOJcGgT lq0d7+vvYHfmRgs4YXjqyJQDuAgE2g8H0k0J+uSjf2upPATXkFPnw+eFA7cjK459lAP7 1VmGUKrt/v2ZRngz+JKXcV4baNFzJa9mNvh/xPkjH0p3Xs56d8SS6UcvJIUnbhhzn814 m9j95pkkBJOfqhBi4G3caFYDFMoks6Hiz52YJ+fARtYu4r67+9nf0vkZola4ATso+nz6 thmtBdqUe4t/KwCaOqgLPSvW88yptPP2x02oGhEojbOwtLfFJow1xWFp0xXZmePsQYJZ jJXA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Sl1Vn1U3tl93hBaaxt4fpjEsurZi7WymWG2DW9TF7+4=; b=Bk9zIj9uOrBjLvUxZLq1uIAZyVSg4olJjTMRSq6CLykKrS2Gh68+hQZi5otfPIDL1M 2iNh22NyMgH8hiolDVCQZZIUZM0HHFkfw6HqfHzxojkvA5/jetngizs0y1VgiQfugH9e bhUfdNpZOro0WXvJ9GuNfMzsrxqrw1guELLS/PBwKNe+5JBkQ1wa1m3icn2E1ZbhjCNP i+OV7FuYZhqu+tLHsAY9HQqolhMIQ6LPnuwEKewq+tq0W5aoL6c0RBkXmg2HQJfAU3ha l5M8Lu6hKsO+2lmFSIAr6shkgAk0EPYaMdSAsaV5dYTMU7NQz02PXNUN+jUQ8BXOmAB5 ypVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z8hb1UBo; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id i10-20020a170902e48a00b00153bc4c8388si23936241ple.499.2022.06.07.22.03.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:03:03 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z8hb1UBo; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D165FC03AC; Tue, 7 Jun 2022 21:30:52 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347248AbiFGReT (ORCPT + 99 others); Tue, 7 Jun 2022 13:34:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346853AbiFGRZc (ORCPT ); Tue, 7 Jun 2022 13:25:32 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C5321109A2; Tue, 7 Jun 2022 10:23:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 00CD3CE21A9; Tue, 7 Jun 2022 17:23:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3FAAC385A5; Tue, 7 Jun 2022 17:23:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654622600; bh=ZRBlCTHt0pyFWYQr3Ew2t9lLWa2U4S35aOox2RxugS8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z8hb1UBonMFHHmNcUVYkLMcbik7CzlhDwnrBOH+mDBr/Xw0a5xhZvDoij59vkHgNn dAxfTULZOPZai/+iRjG54gSMRMSQT7a/39+c2gf4VD4jnPPNph/EGo8AJF3HBrwvlz HrV851E0L8jdBEejtpi44l9Myo5c0IdbVwMqp6p0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 077/452] media: rga: fix possible memory leak in rga_probe Date: Tue, 7 Jun 2022 18:58:54 +0200 Message-Id: <20220607164910.847912580@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164908.521895282@linuxfoundation.org> References: <20220607164908.521895282@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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: Hangyu Hua [ Upstream commit a71eb6025305192e646040cd76ccacb5bd48a1b5 ] rga->m2m_dev needs to be freed when rga_probe fails. Signed-off-by: Hangyu Hua Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/rockchip/rga/rga.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c index d99ea8973b67..e3246344fb72 100644 --- a/drivers/media/platform/rockchip/rga/rga.c +++ b/drivers/media/platform/rockchip/rga/rga.c @@ -868,7 +868,7 @@ static int rga_probe(struct platform_device *pdev) ret = pm_runtime_resume_and_get(rga->dev); if (ret < 0) - goto rel_vdev; + goto rel_m2m; rga->version.major = (rga_read(rga, RGA_VERSION_INFO) >> 24) & 0xFF; rga->version.minor = (rga_read(rga, RGA_VERSION_INFO) >> 20) & 0x0F; @@ -884,7 +884,7 @@ static int rga_probe(struct platform_device *pdev) DMA_ATTR_WRITE_COMBINE); if (!rga->cmdbuf_virt) { ret = -ENOMEM; - goto rel_vdev; + goto rel_m2m; } rga->src_mmu_pages = @@ -921,6 +921,8 @@ static int rga_probe(struct platform_device *pdev) free_dma: dma_free_attrs(rga->dev, RGA_CMDBUF_SIZE, rga->cmdbuf_virt, rga->cmdbuf_phy, DMA_ATTR_WRITE_COMBINE); +rel_m2m: + v4l2_m2m_release(rga->m2m_dev); rel_vdev: video_device_release(vfd); unreg_v4l2_dev: -- 2.35.1