[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190806.143525.1706858782072027944.davem@davemloft.net>
Date: Tue, 06 Aug 2019 14:35:25 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: nishkadg.linux@...il.com
Cc: andrew@...n.ch, vivien.didelot@...il.com, f.fainelli@...il.com,
netdev@...r.kernel.org
Subject: Re: [PATCH] net: dsa: qca8k: Add of_node_put() in
qca8k_setup_mdio_bus()
From: Nishka Dasgupta <nishkadg.linux@...il.com>
Date: Sun, 4 Aug 2019 21:00:18 +0530
> Each iteration of for_each_available_child_of_node() puts the previous
> node, but in the case of a return from the middle of the loop, there
> is no put, thus causing a memory leak. Hence add an of_node_put() before
> the return.
> Additionally, the local variable ports in the function
> qca8k_setup_mdio_bus() takes the return value of of_get_child_by_name(),
> which gets a node but does not put it. If the function returns without
> putting ports, it may cause a memory leak. Hence put ports before the
> mid-loop return statement, and also outside the loop after its last usage
> in this function.
> Issues found with Coccinelle.
>
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@...il.com>
Appplied.
Powered by blists - more mailing lists