Re: [PATCH] net: mdiobus: Fix memory leak in __mdiobus_register
From: Dan Carpenter
Date: Tue Sep 28 2021 - 09:53:04 EST
On Tue, Sep 28, 2021 at 01:58:00PM +0100, Russell King (Oracle) wrote:
>
> This thread seems to be getting out of hand.
The thread was closed. We need to revert Yanfei's patch and apply
Pavel's patch. He's going to resend.
> So, I would suggest a simple fix is to set bus->state to
> MDIOBUS_UNREGISTERED immediately _after_ the successful
> device_register().
Not after. It has to be set to MDIOBUS_UNREGISTERED if device_register()
fails, otherwise there will still be a leak.
Adding a comment is a good idea.
regards,
dan carpenter