From patchwork Mon Oct 24 11:30:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8445 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp401658wru; Mon, 24 Oct 2022 04:48:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7I5dTwjWrkYUGa7WBTvx0WDMFSdgpEe4NQqaUrkF2iVgzNk9CM97UdnYO4xoAMfnvzxsTm X-Received: by 2002:a17:90b:1a84:b0:20d:5086:3694 with SMTP id ng4-20020a17090b1a8400b0020d50863694mr38883356pjb.74.1666612136561; Mon, 24 Oct 2022 04:48:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612136; cv=none; d=google.com; s=arc-20160816; b=Ccg5BasyPjwvpHz7bIMWOPrlA12vws4vnHZEYTOW37zkSMXQvwm1vPNBWMcrzWHpbT att1bERHmt04yKlLEecXt98Ud4O3cR0En7Dhu+6s/59CFBphgQcIH1+8B6zi+Z52Dx01 C9TcnwddV4G4JNPBez/jYkBHTYrQgQ1dg07DQgsnQyJ9Zh2Su+3mGa3QqTayGx+4CpiZ F8cqk562cKXwrf/PYZHxdY8Sj7TydovfYEdI9Uh3JP8Z8III9oksH9TZbUCm6E4my9q7 QyHifqPe+o1pVha5coz++m2h4pCo6mb4QideFRuGVXnAbHLqrQ9BURFhqIrToN80A56f PVpg== 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=j/xQ+GJKG00B4xU0/JcPSHoS8CpRNTbVYj6kSEcWFaQ=; b=UdLnQbyTYhbTgjMOdUG7gOxAX/aBk886ucnr+o2SibEU0Gy4pA54uhWJcCUkPGN9z9 W+/lAL3afts3bZ34B0YVI6dwtWsxE/ZkmzIwqPwq/TvLCZhw2KP0Ako3LYanB0djM6Rp Gs/B8TcoCZmRBc1n4X4er0hNzVaJ8GN59wM3S2rhrJ2oyfgf8PAy2m5Tl/Rooe2I+n1/ syvuTp49h3MS4ttICWYKWc/s3fYtEvEDoeLUpGABs/ldAn/hroItCoHZgUtheWZSXR2y tvTKkK6HfZdut9Q+IZfJeD+pNF03oEsGnBvLuDkMiHfgFCk3CtcGNBOcgZccK9z9ZnZV 1/tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pS66SZsW; 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 s6-20020a63b406000000b0043aa67c7d8esi32389344pgf.738.2022.10.24.04.48.43; Mon, 24 Oct 2022 04:48:56 -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=pS66SZsW; 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 S231549AbiJXLsM (ORCPT + 99 others); Mon, 24 Oct 2022 07:48:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231687AbiJXLrU (ORCPT ); Mon, 24 Oct 2022 07:47:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8F7E6EF2B; Mon, 24 Oct 2022 04:42:50 -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 5DA69B8113E; Mon, 24 Oct 2022 11:42:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA666C433C1; Mon, 24 Oct 2022 11:42:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611755; bh=//JnKSgNXoTTrTg8+1UvYR3LNAJAPNMWNCUL101lLtU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pS66SZsWho/Beon/docKm8TKVwjjORn5wrV1hUc0HqmQpfMKNoYwp93O3j2jH5yAF RgI5sDwIa1TA/jlsrfkoGNQ/bkXa/yNyFhpThuJIDtfvl8CaTZ1jfP0fef8jjQCBDh v69xZnlic19KmXS3D36xYM7jjc5xBtSbwIK3duPw= 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 4.9 099/159] media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init Date: Mon, 24 Oct 2022 13:30:53 +0200 Message-Id: <20221024112953.053104501@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569487760750006?= X-GMAIL-MSGID: =?utf-8?q?1747569487760750006?= 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 feb3b2f1d874..df21646ef9fa 100644 --- a/drivers/media/platform/xilinx/xilinx-vipp.c +++ b/drivers/media/platform/xilinx/xilinx-vipp.c @@ -462,7 +462,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) { @@ -472,13 +472,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)