Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2955057pxa; Tue, 25 Aug 2020 07:49:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbiwzy/iVdUlxJ+WRh797b0R1qrJIFI9K5ObRI8aQC5/3tk0NJnwhBOvC6DhWwqmNm/gve X-Received: by 2002:a17:906:3bc1:: with SMTP id v1mr10867960ejf.233.1598366984740; Tue, 25 Aug 2020 07:49:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598366984; cv=none; d=google.com; s=arc-20160816; b=TnB+Zpda1KN5bKbTweDRy2AVIJNKcJYZI0j6uE7K2JGOyrRN0dmWPRL55pcvJvJxDV R4lfM9pRkkEiREJ+8ewOGlzHdmtJ95Q1kIeIJEtrZrl9in8J8Tj80NlrrcNO3548+U+3 u7a7IdNYw0/OgnxHqgfzLvnn/HGssyvGyKi+9+qHT1/u13zoAg7UUgwi0l4zjjcsPsxP QUePamx3wTyMJptt1a/zDc3mzn4sd2cNM+/B5Yw/ayHsvjPQ+yCM3n3eQKwXvhBTLb2n GlTgDpQfGhULqJOUrFZsgmzn6SPCN5WlJ7bpS3OFAJXT53BgatZFH1VDs7ViUkdtLeyA 0OOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=gwC46fd9XbMoUjz9Ln6GQHaJFH+R3tM9rE/Pdwp/x/M=; b=vN1rgHXbveCopx/ryCtAajSxjUxCYhyfCAj10S43Y9WPxZz8MMQTLEs5WFHDSbnnPT hF3Eb9htu9/nxDv3eyaonVS/DMR7PwSNZnxN1Ljw+UfPl6IwjhZswbTgyfaEnqUmMybD lKsyCF1EaJaH9C5fkLixJq6jk1ePdRIFQU75QgTLaJlA2DiG3jIxCB2wB0F623wup/P7 QjYcjQQqKTLi/7HFZk3VSjhen5S+qrJpfZQoq2bURMViJfDPwubpsDSk4wgI5dNdtksv 2qqoaC97VaxFo1ZBSCQkTMNzY3MiVhTe1roL6vHJrCBxNP/ndsPrQn9JpJLtjtcVSAGd AvXg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a5si8489069ejt.549.2020.08.25.07.49.21; Tue, 25 Aug 2020 07:49:44 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726570AbgHYOsr (ORCPT + 99 others); Tue, 25 Aug 2020 10:48:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726351AbgHYOsp (ORCPT ); Tue, 25 Aug 2020 10:48:45 -0400 Received: from shards.monkeyblade.net (shards.monkeyblade.net [IPv6:2620:137:e000::1:9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8111C061574; Tue, 25 Aug 2020 07:48:44 -0700 (PDT) Received: from localhost (unknown [IPv6:2601:601:9f00:477::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id E72E3133F5728; Tue, 25 Aug 2020 07:31:56 -0700 (PDT) Date: Tue, 25 Aug 2020 07:48:42 -0700 (PDT) Message-Id: <20200825.074842.773732876988634467.davem@davemloft.net> To: sylphrenadin@gmail.com Cc: Julia.Lawall@lip6.fr, andrew@lunn.ch, sean.wang@mediatek.com, vivien.didelot@gmail.com, f.fainelli@gmail.com, kuba@kernel.org, matthias.bgg@gmail.com, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V4] net: dsa: mt7530: Add of_node_put() before break and return statements From: David Miller In-Reply-To: <20200824200311.GA19436@Kaladin> References: <20200824200311.GA19436@Kaladin> X-Mailer: Mew version 6.8 on Emacs 26.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Tue, 25 Aug 2020 07:31:57 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sumera Priyadarsini Date: Tue, 25 Aug 2020 01:33:11 +0530 > Every iteration of for_each_child_of_node() decrements > the reference count of the previous node, however when control > is transferred from the middle of the loop, as in the case of > a return or break or goto, there is no decrement thus ultimately > resulting in a memory leak. > > Fix a potential memory leak in mt7530.c by inserting of_node_put() > before the break and return statements. > > Issue found with Coccinelle. > > Signed-off-by: Sumera Priyadarsini Applied, thank you.