[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190725.115256.1232519801887604352.davem@davemloft.net>
Date: Thu, 25 Jul 2019 11:52:56 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: navid.emamdoost@...il.com
Cc: emamd001@....edu, kjlu@....edu, smccaman@....edu,
secalert@...hat.com, peppe.cavallaro@...com,
alexandre.torgue@...com, joabreu@...opsys.com,
mcoquelin.stm32@...il.com, netdev@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] stmmac_dt_phy: null check the allocation
From: Navid Emamdoost <navid.emamdoost@...il.com>
Date: Tue, 23 Jul 2019 17:28:09 -0500
> @@ -342,10 +342,13 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
> mdio = true;
> }
>
> - if (mdio)
> + if (mdio) {
> plat->mdio_bus_data =
> devm_kzalloc(dev, sizeof(struct stmmac_mdio_bus_data),
> GFP_KERNEL);
> + if (!plat->mdio_bus_data)
> + return -ENOMEM;
This leaks a reference to plat->mdio_node() which is acquired in the
for_each_child_of_node() loop right before the context here.
This is what I really fear about these automated patches, it is quite
often the case that acquired resources are subtly acquired in nearby
code and not released by the proposed "fix".
Therefore, either we end up with a regression, or as is the case here
a reviewer invests more time into double checking your patch than you
put into writing the patch in the first place.
Powered by blists - more mailing lists