From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: Tejun Heo <htejun@gmail.com>
Cc: James Bottomley <James.Bottomley@SteelEye.com>,
Jeff Garzik <jeff@garzik.org>,
"linux-ide@vger.kernel.org" <linux-ide@vger.kernel.org>,
SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] libata: fix probe_ent alloc/free bugs
Date: Sat, 17 Feb 2007 20:43:48 +0300 [thread overview]
Message-ID: <45D73ED4.80505@ru.mvista.com> (raw)
In-Reply-To: <45D73A55.90008@gmail.com>
Hello.
Tejun Heo wrote:
> ata_probe_ent_alloc() had a temporary hack such that devm_kzalloc()
> was used for allocation if devres had been previously initialized on
> the device; otherwise, plain kzalloc() was used. This was to make the
> code useable from both the old and devres-aware libata drivers during
> transition. This hack made ata_sas_port_alloc() unable to determine
> how the probe_ent is allocated, causing double free in some cases.
>
> Remove the now-unneeded hack and make ata_sas_port_alloc() use
> devm_kfree().
[...]
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index 2cf8251..c34e0b4 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -5891,11 +5891,7 @@ ata_probe_ent_alloc(struct device *dev, const
> struct ata_port_info *port)
> {
> struct ata_probe_ent *probe_ent;
>
> - /* XXX - the following if can go away once all LLDs are managed */
> - if (!list_empty(&dev->devres_head))
> - probe_ent = devm_kzalloc(dev, sizeof(*probe_ent), GFP_KERNEL);
> - else
> - probe_ent = kzalloc(sizeof(*probe_ent), GFP_KERNEL);
> + probe_ent = devm_kzalloc(dev, sizeof(*probe_ent), GFP_KERNEL);
> if (!probe_ent) {
> printk(KERN_ERR DRV_NAME "(%s): out of memory\n",
> kobject_name(&(dev->kobj)));
[...]
The patch certainly looks mangled tab-wise. :-)
MBR, Sergei
next prev parent reply other threads:[~2007-02-17 17:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-17 14:27 [PATCH] libata: fix probe_ent free in ata_sas_port_alloc() Tejun Heo
2007-02-17 15:16 ` James Bottomley
2007-02-17 17:24 ` [PATCH] libata: fix probe_ent alloc/free bugs Tejun Heo
2007-02-17 17:43 ` Sergei Shtylyov [this message]
2007-02-17 18:19 ` James Bottomley
2007-02-17 18:27 ` Sergei Shtylyov
2007-02-17 18:09 ` James Bottomley
2007-02-20 8:37 ` Tejun Heo
2007-02-20 15:52 ` Jeff Garzik
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=45D73ED4.80505@ru.mvista.com \
--to=sshtylyov@ru.mvista.com \
--cc=James.Bottomley@SteelEye.com \
--cc=htejun@gmail.com \
--cc=jeff@garzik.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/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).