[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20130228.153843.113719126611463624.davem@davemloft.net>
Date: Thu, 28 Feb 2013 15:38:43 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: oss@...at.biz
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH v2] phy: Fix phy_device_free memory leak
From: Petr Malat <oss@...at.biz>
Date: Thu, 28 Feb 2013 12:01:52 +0100
>
> From: Petr Malat <oss@...at.biz>
>
> Fix memory leak in phy_device_free() for the case when phy_device*
> returned by phy_device_create() is not registered in the system.
>
> Bug description:
> phy_device_create() sets name of kobject using dev_set_name(), which
> allocates memory using kvasprintf(), but this memory isn't freed if
> the underlying device isn't registered properly, because kobject_cleanup()
> is not called in that case. This can happen (and actually is happening on
> our machines) if phy_device_register(), called by mdiobus_scan(), fails.
>
> Patch description:
> Embedded struct device is initialized in phy_device_create() and it
> counterpart phy_device_free() just drops one reference to the device,
> which leads to proper deinitialization including releasing the kobject
> name memory.
>
> Signed-off-by: Petr Malat <oss@...at.biz>
This looks great, applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists