Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1850384ioo; Mon, 23 May 2022 04:54:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfrowgQ5TjQRj2wXUSFUsJCmd1wX+fIq18L4U4pgAFg1qhlzoH4+HmvdU2z0qEx580kKQe X-Received: by 2002:a17:90a:690f:b0:1df:336d:5533 with SMTP id r15-20020a17090a690f00b001df336d5533mr25831348pjj.222.1653306857028; Mon, 23 May 2022 04:54:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653306857; cv=none; d=google.com; s=arc-20160816; b=gbNyGuO29M+WPjBbUbRA92J1btcEr/YcyufTTdy6rfAIKFApGUAIInspPN1GBXypUA 1OfYoMvLXQEmLGcAJ9ZeASVWJIviEkmU7N/nsC9QWu0Io/4nmhmNJUVbDb7gpu+4v2CN kJb/PIxYa2gV4UIYaWlSeC6Zi/kku5D3kgrcINX8UCBUjSc/PYeNRgXX5HOPj5f8ifOv mUZ2rlmEqtCjwaozpB0tPZ7gXvPBrdYoT0uIr0ZY2j+KLvDovoG+/q1zDz4rj0a9jtqn Qmstq4TrIhlTuDhgSBe20i0ErAmJVN6eVOBPruB5ibPyEOADF7qqW2x2VTntKfPjGqwY YSfQ== 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=xdAbJnQi7AwrRtI/IG9BaqYaFi1J+HfGxhWdgxWSHiw=; b=NGPuKrZFnodIKabTGynW+6fWCYsAgrIXWnn9vgpPTtbjO3w46Z1PPwUp4fed7WotqN Rxe9g7SbAROJBjNBuRfRZT3spU6LimFsrIE7/y4pBMnbgofc2ACpDWfQX4np1+dAnstc aSVJwzLjKpmLcy2C+h0ocO12mVLwlvfWp8TsJ52iVRV/0j3m4r6Ot25YDq765OM/yF2J 9DhHr5njugC/5+/u5DDoBZYIEc0PiRYTo9mmZt++9vuEvPecvBrVHIzr7LyjNalryHfr XYcasLNf/RksqMID6vjVPMim9XCn07FalOOBGoZw789/zYgokuJJpf/Kib3wRNGaXfru 24Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EVk+PSIl; 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=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id e11-20020a17090ab38b00b001cb7ed1747fsi12920129pjr.171.2022.05.23.04.54.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 04:54:17 -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=@kernel.org header.s=k20201202 header.b=EVk+PSIl; 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=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C35A551586; Mon, 23 May 2022 04:54:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235122AbiEWLyC (ORCPT + 99 others); Mon, 23 May 2022 07:54:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235061AbiEWLx5 (ORCPT ); Mon, 23 May 2022 07:53:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B250250B08 for ; Mon, 23 May 2022 04:53:56 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 08095612CA for ; Mon, 23 May 2022 11:53:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E9BBC385AA; Mon, 23 May 2022 11:53:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653306835; bh=zRFVyDMxaTcsTQxdZCirp8RdZgXfIBOcClwrybOlKXc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EVk+PSIlVPaob1w+LkxcgQAo2Z0weTeIupgGRKHcOUbDiTmEWy5TdBms65ZIyuh3b HAF+3fwzEgdHPXkIgK1ZhWm68wwPLqdB+y9j+mN945qLRbWUwWJ16r7qBe5iETG/Wy FSlvYP7BmK0snt+um2VfZMa6AI6uCSWO90/GLFFODFSSP4Ytz/Hm+16hpKhfOEq194 oQbv7i9fd2GDCEApEUWS6hGsfcKoJNtPu6O2TDvvScjVBKePJe856Ra7GXMij6TAPa G/Vzlb7Gc1pdrKDqysXqqaasDmO6sw2qIb7SZQ1uPvNmNCtOyAckoxQPHpTHPNC0zU +7a4o+xNz9nyg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1nt6dE-00031F-Pm; Mon, 23 May 2022 13:53:52 +0200 Date: Mon, 23 May 2022 13:53:52 +0200 From: Johan Hovold To: cgel.zte@gmail.com Cc: sudeep.holla@arm.com, cristian.marussi@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Minghao Chi , Zeal Robot Subject: Re: [PATCH] firmware: arm_scmi: Avoid leak OF node on error Message-ID: References: <20220523111116.2898-1-chi.minghao@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220523111116.2898-1-chi.minghao@zte.com.cn> X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 On Mon, May 23, 2022 at 11:11:16AM +0000, cgel.zte@gmail.com wrote: > From: Minghao Chi > > The OF node should be put before returning error in smc_chan_available(), > otherwise node's refcount will be leaked. > > Reported-by: Zeal Robot > Signed-off-by: Minghao Chi > --- > drivers/firmware/arm_scmi/smc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/firmware/arm_scmi/smc.c b/drivers/firmware/arm_scmi/smc.c > index 745acfdd0b3d..43018be70edc 100644 > --- a/drivers/firmware/arm_scmi/smc.c > +++ b/drivers/firmware/arm_scmi/smc.c > @@ -55,10 +55,10 @@ static irqreturn_t smc_msg_done_isr(int irq, void *data) > static bool smc_chan_available(struct device *dev, int idx) > { > struct device_node *np = of_parse_phandle(dev->of_node, "shmem", 0); > + of_node_put(np); > if (!np) > return false; > > - of_node_put(np); > return true; > } NAK