]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
net: gianfar: Add of_node_put() before goto statement
authorSumera Priyadarsini <sylphrenadin@gmail.com>
Tue, 18 Aug 2020 18:52:41 +0000 (00:22 +0530)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 16 Sep 2020 09:15:01 +0000 (05:15 -0400)
commit9b8a69265f2429171e02c95364c2222f0b554c8b
tree5e1a3a0cedf5bffd810b0d4ed9d7a8e7c1fd8b41
parent48ccf04c3ef6911185d5d07d4bc315a8e7f449f8
net: gianfar: Add of_node_put() before goto statement

BugLink: https://bugs.launchpad.net/bugs/1895174
[ Upstream commit 989e4da042ca4a56bbaca9223d1a93639ad11e17 ]

Every iteration of for_each_available_child_of_node() decrements
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 gianfar.c by inserting of_node_put()
before the goto statement.

Issue found with Coccinelle.

Signed-off-by: Sumera Priyadarsini <sylphrenadin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/ethernet/freescale/gianfar.c