Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4600875pxj; Wed, 12 May 2021 09:01:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyntvzUX/C7O+z7Ggqvb7MQnTXWXJt1Uqdd0aYZ8ugWHGcSRFbDHindGaPRfOBKh9AFyj4S X-Received: by 2002:a50:ccc9:: with SMTP id b9mr43373604edj.316.1620835306705; Wed, 12 May 2021 09:01:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835306; cv=none; d=google.com; s=arc-20160816; b=Qro3r5bXKLk6QqSSq+lnm9Ym96zN1QRT8nhaM+eh2zstcoVHHEetnSqzE1PxmQ9Bfo 4t8RII8Y9JXpNzIVBzpAAQmbskgwSTdaZKfOoS+vABPRU9JtomJ4bydxP11aXBgZ2T6/ 8qrbFDoqTCVFPR5fMeDuLnCeWE/Pa8CxBi77ioC6CpUGiD6Co7Cyc1x24wNFV6wTCXar 9B3bP5migWdwDmbigCHm8mNZaWLx+rkLrL9KtxfZqsI1HmGBv2biVnr+JPl4N5j5J6H6 YVG2adcatWpZ0d7IfemSY18MvapyB6fOZf2LskX/sMBQ4clyJNi6z+PRaJfaizffMHw6 Rdwg== 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=SCrbHEKiZW9ocrgcjxLG6kWcslPQexUSN0MOxPmEw5A=; b=gtSY/Oes4ql9M6/5JHLsJO/R2Vo7yvJKkACo4jyDRNYM3KUCFVC2ScO42ZCQCdcSAE vHCGdP8UsiYEl1C2Fmiy7+BSOAQmFAGVSyoyqlZVonVdR0UrI1nrfMuRgUZMZF91vDrk 2TXC0SFvZ7ZAA3AUeJZDivxz+Xz7Xce9s4bAOflbL3pdD3ABZfoWIoAce7MrYYEfVzHV Vumm1bsGz0VCloJxJNZluNdMVzpgqBbJlleuStnAc/828IxsDbtt+RHo0hAH+ImYNxO6 MohwpSYksDB+/noXVcRZT4MgYDOSZ6Mp0TnNkoDN4b4EY0Xx5zyvfdx73PuPsyxTqO56 iU5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=e4E50fhA; 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 e1si243547ejx.431.2021.05.12.09.01.21; Wed, 12 May 2021 09:01:46 -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=e4E50fhA; 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 S237134AbhELPzo (ORCPT + 99 others); Wed, 12 May 2021 11:55:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:40904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235094AbhELP0u (ORCPT ); Wed, 12 May 2021 11:26:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C042461425; Wed, 12 May 2021 15:11:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832298; bh=2o6DU6hH7ysLOdTIQHG/FewhYFKML5hyRDqHm0YzfW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e4E50fhARmFMS/1HWx1fZ3JRn/NZpSdMuET0GOeAA+Ej/bDT6YOMK2yuSiONIm3Lr lzkeQ6KaXuERu3uYfWjbEZ9DDc4L5bQ/2yeSrQM+4ehs8StiFeJaZt4j8kAfs6CHlM vjyFZF3GsYpLSlfk8hoIEo2x4NLFQLyFBEnpjwmQ= 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 5.10 187/530] bus: qcom: Put child node before return Date: Wed, 12 May 2021 16:44:57 +0200 Message-Id: <20210512144825.984654673@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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 03ddcf426887..0b8f53a688b8 100644 --- a/drivers/bus/qcom-ebi2.c +++ b/drivers/bus/qcom-ebi2.c @@ -353,8 +353,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