Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp545749pxj; Thu, 20 May 2021 15:52:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDvkrsdZex4WpWxjvjKvbYEefumySR9gKWuqiXxUddB51Pdt+zZvFyGBJM+LJc9nlcm+aU X-Received: by 2002:a05:6e02:1088:: with SMTP id r8mr8531310ilj.76.1621551158185; Thu, 20 May 2021 15:52:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621551158; cv=none; d=google.com; s=arc-20160816; b=tSvPgdv6ENPuUi4eUVmy2V5cv/I2f7RwhDPoNsHD4pUdLN9JUaaiUaJNgLemvclerj YtG2J22g1ssa7TRsKuSsF3UBpr9mkRBKxkfWwkiP6AyidCIfiMuilLUgiMaULtmSbWlw hE/b9XQTTew9nTF+pKsiohlLLxQyPr5jYwuLynKinWGXQJI7IENpiMHRQ/7IdmowICgv 5YsH75VTnJUQj5lpl+fOTZHh2OMvHD8P/djdrm7j7NsyFd3HpJ60Qf+4P7EnFecWz8E4 nJpNsute48BqpylyKKI0/4mJ1nDYovV469oINBvYU/+++sUNQMSKv7i8BOh36KE+qxsn +XKg== 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=e/rXVo4Gn/j30Em/IQm2VVJ5EFCWLao2iLc3WEf+XBQ=; b=nasOchUhWAgwlJMACdskiXIDXlSLvpvoG4gjjVNLd+wL0uzYzmid6bLwavPOzf44Q0 rEG+Y/eNFCYQFlL/D4L/ozqKEWRRnIEIGQAXX3i895To1JjcaRNN2iQtAyptUZRWJs8i 8rBDLrVdsItVBtodT3FDIiUpX12eobeuWigyncwzA+tXI+fWUw5HFJbcutvR9JViWbQz eebz7494C7jd9rBVP0FG+Fwhh1vN/eFU/bySHMTzsY6yyLvvIRq0prllmnvORzcfqUsC dHFgmExyUFfQB5+rJ3WcffCbz2k3OVqGKkXVr/S60WyarsqDr2OnMg0rU60hBKfUpkGA nLDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ScKRz3YB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s18si3812883ilh.102.2021.05.20.15.52.23; Thu, 20 May 2021 15:52:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ScKRz3YB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S240581AbhETLO4 (ORCPT + 99 others); Thu, 20 May 2021 07:14:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:52608 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238989AbhETKyW (ORCPT ); Thu, 20 May 2021 06:54:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D24FD6141E; Thu, 20 May 2021 10:01:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504864; bh=wuEv9uLP2+8BvOM9r0lSZMHS1SSZLXzGGyT9AoTcsCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ScKRz3YBgE3piz+hr4n9Oe8ygxSHH1TZ4Xx7FJ7sSpvjuprBqXPOp+BcO9LexPfaJ dpM/VJuS3QTEl7IsMfhj/ODYV50Go9Lk5yzwgduM1rbb23NXILn750phjk2cfYQTv3 7SGKNrP2M+XjpSj0tUlsQ0QDDAETMtbUfncg6c9c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Pan Bian , Bjorn Andersson , Sasha Levin Subject: [PATCH 4.9 108/240] bus: qcom: Put child node before return Date: Thu, 20 May 2021 11:21:40 +0200 Message-Id: <20210520092112.305287969@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092108.587553970@linuxfoundation.org> References: <20210520092108.587553970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pan Bian [ Upstream commit ac6ad7c2a862d682bb584a4bc904d89fa7721af8 ] Put child node before return to fix potential reference count leak. Generally, the reference count of child is incremented and decremented automatically in the macro for_each_available_child_of_node() and should be decremented manually if the loop is broken in loop body. Reviewed-by: Linus Walleij Fixes: 335a12754808 ("bus: qcom: add EBI2 driver") Signed-off-by: Pan Bian Link: https://lore.kernel.org/r/20210121114907.109267-1-bianpan2016@163.com Signed-off-by: Bjorn Andersson Signed-off-by: Sasha Levin --- drivers/bus/qcom-ebi2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/bus/qcom-ebi2.c b/drivers/bus/qcom-ebi2.c index a6444244c411..bfb67aa00bec 100644 --- a/drivers/bus/qcom-ebi2.c +++ b/drivers/bus/qcom-ebi2.c @@ -357,8 +357,10 @@ static int qcom_ebi2_probe(struct platform_device *pdev) /* Figure out the chipselect */ ret = of_property_read_u32(child, "reg", &csindex); - if (ret) + if (ret) { + of_node_put(child); return ret; + } if (csindex > 5) { dev_err(dev, -- 2.30.2