[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <283d01f0-d5eb-914e-1bd2-baae0420073c@gmail.com>
Date: Tue, 28 Sep 2021 14:06:20 +0300
From: Pavel Skripkin <paskripkin@...il.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Yanfei Xu <yanfei.xu@...driver.com>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
andrew@...n.ch, hkallweit1@...il.com, linux@...linux.org.uk,
davem@...emloft.net, kuba@...nel.org, p.zabel@...gutronix.de,
syzbot+398e7dc692ddbbb4cfec@...kaller.appspotmail.com,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
Dongliang Mu <mudongliangabcd@...il.com>
Subject: Re: [PATCH] net: mdiobus: Fix memory leak in __mdiobus_register
On 9/28/21 13:59, Dan Carpenter wrote:
> On Tue, Sep 28, 2021 at 01:46:56PM +0300, Pavel Skripkin wrote:
>> > diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
>> > index ee8313a4ac71..c380a30a77bc 100644
>> > --- a/drivers/net/phy/mdio_bus.c
>> > +++ b/drivers/net/phy/mdio_bus.c
>> > @@ -538,6 +538,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
>> > bus->dev.groups = NULL;
>> > dev_set_name(&bus->dev, "%s", bus->id);
>> > + bus->state = MDIOBUS_UNREGISTERED;
>> > err = device_register(&bus->dev);
>> > if (err) {
>> > pr_err("mii_bus %s failed to register\n", bus->id);
>> >
>> >
>> yep, it's the same as mine, but I thought, that MDIOBUS_UNREGISTERED is not
>> correct name for this state :) Anyway, thank you for suggestion
>>
>
> It's not actually the same. The state has to be set before the
> device_register() or there is still a leak.
>
Ah, I see... I forgot to handle possible device_register() error. Will
send v2 soon, thank you
With regards,
Pavel Skripkin
Powered by blists - more mailing lists