Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7402071ybi; Thu, 1 Aug 2019 07:40:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwdXNvWdlx3oSL28kCpgdP4LPzF7kDk7rTqDGNRG7gvDRsNYIsKgo6jSbdpJkjeNDcNtrk5 X-Received: by 2002:a17:90a:dac3:: with SMTP id g3mr9078696pjx.45.1564670417795; Thu, 01 Aug 2019 07:40:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564670417; cv=none; d=google.com; s=arc-20160816; b=lstANkU+NQkBalKvYKuBsG1kgBpOZ6OBqy5oYOK4QqaUjhXLhnyrJ3vZpADT3wdhxJ /qu0ckuksrKZYVayww6nhN+aFVgKmCAEansMDNUiMu7CH66TlrI/im5ggOehARxdG+5m TOG8oUKPqerNrjDaVOoPBKtwHjDo8VK76lo6rcM6cauVJIvkrwgC8SJLp81YEvgl5iub clCQ2KttTiRvjQhNAQkBkNI6l78x1+6xDwMUofG9DddA0quQlStHf4NWbxX/MFde0t13 OGPNQfIQKOvHfMSMOHnjuo3zwPng9w0wcaJWJ6GzEZkTq7wnv41AsMedibOmGah+uH+2 FM6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature; bh=Ta6SVOPfBEUXAoK68k+AFFQ870iLGBNa1TpwByQ+Eno=; b=PV9/eC9Q6Fmj01nTTDmj+T7MqyXOTJ7Vm9UW49h6eZZWIvAuQggiCvmjcYW95Fopia wN+cjN7uFoihXFA4qSet9ndOAINQ7z88ACdC4PrrwGEiwi89TV3DFe8PAi9/7iLro4rf zDWgr5CdTv3PMHGZRpNdCEgbch0Fol4McriHD0QCG3qEP6rTa2EhgVMieJqjCcwY4iKs IDsc9GHnevlmbvcsr10Lii080YYcKuQCePsf1N5c8FJOiZq8qKyuFUT12rzjOShtoGTl zmBL2AaS9cuYJqxGdWzsGmbGzwkf4qX7UOBY+ROarRfXBFf1SHN4kR7KZ3CS6xlE6GVO xXUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=COM4R8O8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e20si4864663pgn.181.2019.08.01.07.40.02; Thu, 01 Aug 2019 07:40:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=COM4R8O8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731699AbfHANLB (ORCPT + 99 others); Thu, 1 Aug 2019 09:11:01 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:54810 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731661AbfHANKx (ORCPT ); Thu, 1 Aug 2019 09:10:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=Ta6SVOPfBEUXAoK68k+AFFQ870iLGBNa1TpwByQ+Eno=; b=COM4R8O8UblY lrUXmNhyDp2EkXu40KiUT7eZ/V89UGzoDIIp4mMbesfeWwl3wlMCAAXJsQynd4k8NgMTtSLv/pOGv 6VDCEGLslICkfQ923UFaHHBehYhj8T4fd/Xw7rprt8DFcZ5KAeXDdCqtKYWOO4B+eY7SPSC5ZpqG7 57lNI=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=ypsilon.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1htAr4-0004k5-SQ; Thu, 01 Aug 2019 13:10:50 +0000 Received: by ypsilon.sirena.org.uk (Postfix, from userid 1000) id 64F9D2742C48; Thu, 1 Aug 2019 14:10:50 +0100 (BST) From: Mark Brown To: Nishka Dasgupta Cc: broonie@kernel.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, Mark Brown Subject: Applied "regulator: of: Add of_node_put() before return in function" to the regulator tree In-Reply-To: <20190724083231.10276-1-nishkadg.linux@gmail.com> X-Patchwork-Hint: ignore Message-Id: <20190801131050.64F9D2742C48@ypsilon.sirena.org.uk> Date: Thu, 1 Aug 2019 14:10:50 +0100 (BST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch regulator: of: Add of_node_put() before return in function has been applied to the regulator tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-5.3 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 811ba489fa524ec634933cdf83aaf6c007a4c004 Mon Sep 17 00:00:00 2001 From: Nishka Dasgupta Date: Wed, 24 Jul 2019 14:02:31 +0530 Subject: [PATCH] regulator: of: Add of_node_put() before return in function The local variable search in regulator_of_get_init_node takes the value returned by either of_get_child_by_name or of_node_get, both of which get a node. If this node is not put before returning, it could cause a memory leak. Hence put search before a mid-loop return statement. Issue found with Coccinelle. Signed-off-by: Nishka Dasgupta Link: https://lore.kernel.org/r/20190724083231.10276-1-nishkadg.linux@gmail.com Signed-off-by: Mark Brown --- drivers/regulator/of_regulator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index 397918ebba55..9112faa6a9a0 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c @@ -416,8 +416,10 @@ device_node *regulator_of_get_init_node(struct device *dev, if (!name) name = child->name; - if (!strcmp(desc->of_match, name)) + if (!strcmp(desc->of_match, name)) { + of_node_put(search); return of_node_get(child); + } } of_node_put(search); -- 2.20.1