netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: oss@malat.biz
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] phy: fix phy_device_free memory leak
Date: Mon, 11 Feb 2013 13:57:45 -0500 (EST)	[thread overview]
Message-ID: <20130211.135745.2234923222644574153.davem@davemloft.net> (raw)
In-Reply-To: <20130211112827.GA24817@bordel.klfree.net>

From: Petr Malat <oss@malat.biz>
Date: Mon, 11 Feb 2013 12:28:27 +0100

> From: Petr Malat <oss@malat.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.
> Signed-off-by: Petr Malat <oss@malat.biz>
> ---
> 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:
> Name is freed by phy_device_free(). In the case a device is released 
> trough kobject_cleanup()->device_release()->phy_device_release(), the name
> is set to NULL and it is not freed by phy_device_free(), because it will 
> be freed later by kobject_cleanup().

All of this descriptive information belongs in the commit message
proper.

  reply	other threads:[~2013-02-11 18:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-11 11:28 [PATCH] phy: fix phy_device_free memory leak Petr Malat
2013-02-11 18:57 ` David Miller [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-02-19 19:36 Petr Malat
2013-02-20  3:48 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130211.135745.2234923222644574153.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=oss@malat.biz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).