From patchwork Mon Oct 24 11:30:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9648 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp533185wru; Mon, 24 Oct 2022 09:09:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7yTXmwPy/cXkFlynR2XsR2AnXSgHHhFTAGjn12cWbm6kSz1BrDQZvUZGLyB3eQnCenmcL4 X-Received: by 2002:aa7:c58e:0:b0:461:77b:7bd with SMTP id g14-20020aa7c58e000000b00461077b07bdmr20637358edq.387.1666627749211; Mon, 24 Oct 2022 09:09:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627749; cv=none; d=google.com; s=arc-20160816; b=AnSqPmnaY4TVJ65tW+ehde954zwITwvXV/su3VTo7myN32xP7XESHMm1dPcRRJPJPz BWl7XxNsI0PQKSLNlhwui3xMGJKNcva4A5tGSYVxLKSuuxMB9jQkgxMy0vfSkSTbCxRS MPM1D+nxd9xlp2jDi+tPViPU+qvbhFqZ1gkLVxUpQKpV3ct/6Yay5GPmD1oaC54cezc3 nSjYIFXOGHVa705DmFXI5E73aH4/orlR+UEd9/nAl57hy4S19TQt6j5EmaxOrpu5JmuK VpWKYLGsF8OJmuYLwH3+lLm7/m0/PzX4n8i/VQrVfFOYWeGRmRhTuEVgXVCKG87jVnXB AEKA== 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=rmOBNfZQuM6fDzJ5MCye9A5aZzt4QByqpmDDpkiSopo=; b=jN0fIezkjt6p8dd0t4NoAnmwaNZQp64lzCDC5oBUZFVVUlVpUZ/8MegYW7UKS8CV+x QGZbsF77GW+xOQ4YuE+aSi25Ui1/8+pDwRaSNbBCgoajgM9iagaVn92bFX0M7MVpKD2E D4jRCWpzJaY5wWU/+d9tLXYVU1RUbNhY+mAmMdSb3PPAAE7rEVXqzTzO693vcEFMx2tI sTP57KxwPtBv3eC7E6lZMN17EjAX2EQEDfwPdLS1k4iIb+3TF+//CCyzhUrf5faTZ59o /UdPLiZ43ZlOUE13IEiQzaprQ6c5x73FLW/UJsw/Rz4ma8OdW227sDbo/JNMecj+wnmw dCLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KZmOpVJt; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u1-20020a170906950100b007830f14fffesi113438ejx.375.2022.10.24.09.08.43; Mon, 24 Oct 2022 09:09:09 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KZmOpVJt; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233391AbiJXQH6 (ORCPT + 99 others); Mon, 24 Oct 2022 12:07:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233240AbiJXQEY (ORCPT ); Mon, 24 Oct 2022 12:04:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B56ED11A977; Mon, 24 Oct 2022 07:56:51 -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 ams.source.kernel.org (Postfix) with ESMTPS id 21BF2B8128A; Mon, 24 Oct 2022 12:25:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79094C433C1; Mon, 24 Oct 2022 12:25:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614302; bh=oYRhmtQE/klOFsQCHCsRhaWDY77M6fjbrOG794N8IJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KZmOpVJtc8qUDt2fUJg1AFqlA4QF0cZOaWZL5YhmsSj2qGgaoMyMagmfpdK7EX0Tw SAUThNLDF8g43AfOm3vKpf/lKKfVjf5D5zdVCcC65KbhT0VP51mCKRNZ4vNf1W601u LGC7wgqn3qrNxpIZMaCvbHW9Gc85ZE3JrD9mAnFI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Laurent Pinchart , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 209/390] media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init Date: Mon, 24 Oct 2022 13:30:06 +0200 Message-Id: <20221024113031.677951768@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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?1747585858594518407?= X-GMAIL-MSGID: =?utf-8?q?1747585858594518407?= From: Miaoqian Lin [ Upstream commit 1c78f19c3a0ea312a8178a6bfd8934eb93e9b10a ] of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: df3305156f98 ("[media] v4l: xilinx: Add Xilinx Video IP core") Signed-off-by: Miaoqian Lin Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/xilinx/xilinx-vipp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/xilinx/xilinx-vipp.c b/drivers/media/platform/xilinx/xilinx-vipp.c index cc2856efea59..f2b0c490187c 100644 --- a/drivers/media/platform/xilinx/xilinx-vipp.c +++ b/drivers/media/platform/xilinx/xilinx-vipp.c @@ -472,7 +472,7 @@ static int xvip_graph_dma_init(struct xvip_composite_device *xdev) { struct device_node *ports; struct device_node *port; - int ret; + int ret = 0; ports = of_get_child_by_name(xdev->dev->of_node, "ports"); if (ports == NULL) { @@ -482,13 +482,14 @@ static int xvip_graph_dma_init(struct xvip_composite_device *xdev) for_each_child_of_node(ports, port) { ret = xvip_graph_dma_init_one(xdev, port); - if (ret < 0) { + if (ret) { of_node_put(port); - return ret; + break; } } - return 0; + of_node_put(ports); + return ret; } static void xvip_graph_cleanup(struct xvip_composite_device *xdev)