From: rnayak@ti.com (Rajendra Nayak)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] ARM: OMAP: dma: Fix the kfree ordering
Date: Thu, 13 Jun 2013 19:18:58 +0530 [thread overview]
Message-ID: <51B9CDCA.9010901@ti.com> (raw)
In-Reply-To: <20130613131647.GS21614@n2100.arm.linux.org.uk>
On Thursday 13 June 2013 06:46 PM, Russell King - ARM Linux wrote:
> On Thu, Jun 13, 2013 at 06:39:20PM +0530, Rajendra Nayak wrote:
>> diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
>> index 8a71f75..8e16503 100644
>> --- a/arch/arm/plat-omap/dma.c
>> +++ b/arch/arm/plat-omap/dma.c
>> @@ -2111,8 +2111,8 @@ exit_dma_irq_fail:
>> }
>>
>> exit_dma_lch_fail:
>> - kfree(p);
>> kfree(d);
>> + kfree(p);
>
> Err.
>
> p = pdev->dev.platform_data;
> d = p->dma_attr;
>
> Why is it kfree'ing platform data in the first place? This means that
> a failed bind can't be reattempted later. It also means that an unbind
> plus rebind in userspace will free the platform data leaving stale
> pointers behind.
Right, I just seemed to have overlooked the fact that p was pointing to
platform data. Will remove all the kfree(p) and kfree(d) across the
driver (I just realized this is also the case in .remove)
>
> This is totally nonsense. Don't kfree() data in your driver which you
> haven't allocated yourself!
>
prev parent reply other threads:[~2013-06-13 13:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-13 13:09 [PATCH 0/3] minor omap dma fixes Rajendra Nayak
2013-06-13 13:09 ` [PATCH 1/3] ARM: OMAP: dma: Remove the wrong dev_id check Rajendra Nayak
2013-06-13 13:09 ` [PATCH 2/3] ARM: OMAP: dma: Fix the dma_chan_link_map init order Rajendra Nayak
2013-06-13 13:09 ` [PATCH 3/3] ARM: OMAP: dma: Fix the kfree ordering Rajendra Nayak
2013-06-13 13:16 ` Russell King - ARM Linux
2013-06-13 13:48 ` Rajendra Nayak [this message]
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=51B9CDCA.9010901@ti.com \
--to=rnayak@ti.com \
--cc=linux-arm-kernel@lists.infradead.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).