From patchwork Mon May 29 06:17:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 100084 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1308442vqr; Sun, 28 May 2023 23:19:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5A1wz0pNxoMWdTFRoPz8LWy20i5szdVQ5ilr/VAbWCC+NUQH7VnA3Wgmouo5Sruia7mpV2 X-Received: by 2002:a05:6a20:4394:b0:10f:52e2:4a0a with SMTP id i20-20020a056a20439400b0010f52e24a0amr7173871pzl.18.1685341146371; Sun, 28 May 2023 23:19:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685341146; cv=none; d=google.com; s=arc-20160816; b=Er6bKDp4/r/Qmp58hxKC9MQxz5paSDiadFgNUezoZkrVpKSWtY971hkb4GJSNk2Ntu rn8/hd6s/wWIFk7Sc0/S81eK9c93LOSUDbzdQ0yXTFU8X5MTtkRMgUnWPVV/T8gKnRQ7 OVn4hc7lxnzhj6Ubudn3GuRtOou0eeJAn4ql9FIi2HnzNR7vIcJ58Xwd2rdFMDxQs2hQ NV6DK6r2fvD5C71dTIzDnH+/bdfnnaOaGth8wCrX4NPrKdoD6lgAwzml+a2Z0HEogyGi 8NRcdAUX3bZZhrH/gIhZlwdwnfTpKPrc+AIdWz8twkWjzl3gqwPTfXg9ZdnV1pHxv1bd 3kvw== 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:dkim-signature; bh=LMsxEc3jzv9WRfxtgBWJr+2up3zRX/dSTarm2zC7inQ=; b=bGA2fJriBwCXREBF1px+gHsHlT8HbtZ+Zcx2nXJyqprIEMN2TRu6XbLcrbVVYfiUrH gfTGwP4bO7UApPYkHEHAosRcgCsOlYweKpg+a387j8xlkUvh/uP8/gS3RdqhLmsJLls+ US3KLfXZrN36CbetYOkZOPTVfRCHRHBF137LsCNXirvMEYaSBuW/X8ktGYnW1LfTSXyT q7pcOLOeeW8C3gtgRdZNiQZp9N/rzG6Ok/HjoWih1kN/fj57sYXDf/QpnoGL2GkKlKw4 ZiWEKvdhrBjs3hpZicb3txNqP4hMziM0WvTJZl2BS7fg84/M7qAe6s+Uat7FDPmTxhyx 4I0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="gi6/9Y3B"; 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 v15-20020a63bf0f000000b0053eef60f942si8292451pgf.764.2023.05.28.23.18.54; Sun, 28 May 2023 23:19:06 -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=@wanadoo.fr header.s=t20230301 header.b="gi6/9Y3B"; 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 S230042AbjE2GSS (ORCPT + 99 others); Mon, 29 May 2023 02:18:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231516AbjE2GSO (ORCPT ); Mon, 29 May 2023 02:18:14 -0400 Received: from smtp.smtpout.orange.fr (smtp-22.smtpout.orange.fr [80.12.242.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 750FFF3 for ; Sun, 28 May 2023 23:17:48 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 3WC0q1f0vZvWO3WC0qfklE; Mon, 29 May 2023 08:17:22 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1685341042; bh=LMsxEc3jzv9WRfxtgBWJr+2up3zRX/dSTarm2zC7inQ=; h=From:To:Cc:Subject:Date; b=gi6/9Y3BHoprXzB1QmpY0l7JSneYVDhaJtKS42KT08OOYih3CNQZe2o+xGWLGGQ2P IPizhyvuUSVqgUfgccbqmgypYzMDED6uDiO+Fjk4/bwv86QtekVzH62640Gzqf4Wjb sTqcTCXDneuOqmYJYJJy2hKGfV5w6Y+xHJBetUzkN4Jp0mVLH8HuQQvSioZdQ1X9hA k+cyRePBjlmwiobd5KDUWdqgdOGZ6ItqpNdoFvtEiRP+C8aOIdTek0LoL81tdjB/Dh ssOZLKRDkpfqIndPScmjh67ONpCxVdqNP1C0WwmXqq5X9DhRrGthC+eB+BbDuAWPYt n+04tTi8+jGsQ== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 29 May 2023 08:17:22 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Mauro Carvalho Chehab , Sakari Ailus Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-media@vger.kernel.org Subject: [PATCH] media: v4l2-core: Fix a potential resource leak in v4l2_fwnode_parse_link() Date: Mon, 29 May 2023 08:17:18 +0200 Message-Id: <2ddd10ec9e009bbb85518355f1e09e1ecd349925.1685340968.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,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?1767208277655654676?= X-GMAIL-MSGID: =?utf-8?q?1767208277655654676?= 'fwnode is known to be NULL, at this point, so fwnode_handle_put() is a no-op. Release the reference taken from a previous fwnode_graph_get_port_parent() call instead. Fixes: ca50c197bd96 ("[media] v4l: fwnode: Support generic fwnode for parsing standardised properties") Signed-off-by: Christophe JAILLET --- /!\ THIS PATCH IS SPECULATIVE /!\ review with care --- drivers/media/v4l2-core/v4l2-fwnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c index 049c2f2001ea..b7dd467c53fd 100644 --- a/drivers/media/v4l2-core/v4l2-fwnode.c +++ b/drivers/media/v4l2-core/v4l2-fwnode.c @@ -571,7 +571,7 @@ int v4l2_fwnode_parse_link(struct fwnode_handle *fwnode, fwnode = fwnode_graph_get_remote_endpoint(fwnode); if (!fwnode) { - fwnode_handle_put(fwnode); + fwnode_handle_put(link->local_node); return -ENOLINK; }