Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1042590rwd; Tue, 13 Jun 2023 04:11:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7BcXHMwEcFr6/nb6mjOyYrbbb8/ioGNR4ZSnSU2S09zaF7CsmAgJ2fZH1qrR2iuSuQ3e3S X-Received: by 2002:a17:907:6d24:b0:97d:cda7:f09c with SMTP id sa36-20020a1709076d2400b0097dcda7f09cmr9669415ejc.16.1686654679595; Tue, 13 Jun 2023 04:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686654679; cv=none; d=google.com; s=arc-20160816; b=zF6ek/ThwEogK7IXOCq5xSLSl16ZRbyfqupSHDRDlIU5jjtfz7HYHmDJsvRaSRDBuH 5c/jVIU8xSD8K2Ba38AXZmAwXvV7UOIv1Q3VWMKn1lBXOEtrh8vCIFhjZAYWrZPiIhcb SIMYWwQ0KTt5cdkMXZuS9YF9eNMv1TkSIF4RLx8MVAnVJAU5Kp5GgYorsoSTRidqDRXl v/0zGrBRU7mAmdHoT0uVJ+X4bgiOR0w/7LBL6LQHluW9t0/YSNy9dqrLKOr+LfrGxuZr YxTs0pfGussdBonIIrvLXtWcI4GWen2A5DPQSjRS+qGGMDd3lfwO6L9lTLxW/sBFuyOX AuPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kQTuzqnLpRqKUidpGEHHmSgVE1Ba2xRyjX1GaDoEMAI=; b=fnPy1tpfejcBTxjMmNOECGV2xof0ThcT8cxMCOuxd2fSgOSH63yaEqt3pHht22SkH7 dfB0rV1WWO7gExApPwgeeA0QwLDNNbUskVwS274dEQVwH4F8tB5mEAcG0991sQXWHBrg ETxQJ0YVo81uXCjeGuLbW6Xg7RuNLQdNpLDW8HOspLEZoiPG77BABd8tFhY9pnQDcWN4 0OnbggtY6ngHDZqEojkaI3DXybOxKLylTxx3GbeisEuCvqaFvAcZA3jo6KtRo98H+1eg NeFqMguSUliVEVn+fKiko/i+catj2LU6DfNbOaGGEBZIknyp7uR0uGVeV0gS+KK1Fbdc LJ1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=itOpNpWU; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i5-20020a1709064ec500b00977d468082bsi6280447ejv.40.2023.06.13.04.10.54; Tue, 13 Jun 2023 04:11:19 -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=@intel.com header.s=Intel header.b=itOpNpWU; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239492AbjFMKzY (ORCPT + 99 others); Tue, 13 Jun 2023 06:55:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239539AbjFMKzP (ORCPT ); Tue, 13 Jun 2023 06:55:15 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEEF61B8; Tue, 13 Jun 2023 03:55:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686653714; x=1718189714; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=vEktzoBpSkrn0wkyvocbOkW43+YZyv0TA5B13Xrvmd8=; b=itOpNpWUXrEfWO1BgmdkTN32G1WQDsq/OSKMRuJdly4DPfBGo8R/qZHJ IgFSwQEocnv5Dxa3Ijpl774UBgu1GCTfDU94uzMoKLljkme4VxXcfIPty iE+r2KjYAL5GUpETJI8ehUUviaRc9qFrS3bppXmolgBOD8nLCQbEJYp6+ R41DU9/t9MXPG00Fwmsh0ahGSjqhntOUUTCH2KTWGDGJw4TEUMUY5GsJJ /cV/X0UwFN+A4KMmZOPUhx7nTsDu1nsjikaVYuZ1kFnEQULw4dtfytkc4 S2EKcGNvnKQGl7hzEbWU9Amr92dXr8haJFHBZMhr3ar2a7xVgBMNGw8go A==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="444670611" X-IronPort-AV: E=Sophos;i="6.00,239,1681196400"; d="scan'208";a="444670611" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2023 03:55:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="885806358" X-IronPort-AV: E=Sophos;i="6.00,239,1681196400"; d="scan'208";a="885806358" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2023 03:55:13 -0700 Received: from kekkonen.localdomain (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with SMTP id 1A8A711F9D2; Tue, 13 Jun 2023 13:55:10 +0300 (EEST) Date: Tue, 13 Jun 2023 10:55:10 +0000 From: Sakari Ailus To: Christophe JAILLET Cc: Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-media@vger.kernel.org Subject: Re: [PATCH] media: v4l2-core: Fix a potential resource leak in v4l2_fwnode_parse_link() Message-ID: References: <2ddd10ec9e009bbb85518355f1e09e1ecd349925.1685340968.git.christophe.jaillet@wanadoo.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2ddd10ec9e009bbb85518355f1e09e1ecd349925.1685340968.git.christophe.jaillet@wanadoo.fr> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Hi Christophe, On Mon, May 29, 2023 at 08:17:18AM +0200, Christophe JAILLET wrote: > '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); link->local_node also needs to be non-NULL for the successful case. The condition should take that into account. Could you send v2 with that? > return -ENOLINK; > } > -- Kind regards, Sakari Ailus