From: Lars-Peter Clausen <lars@metafoo.de>
To: Olof Johansson <olof@lixom.net>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.de>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
kernel-janitors@vger.kernel.org
Subject: Re: [patch] ASoC: dapm: using freed pointer in dapm_kcontrol_add_widget()
Date: Wed, 31 Jul 2013 20:33:03 +0200 [thread overview]
Message-ID: <51F9585F.8060505@metafoo.de> (raw)
In-Reply-To: <CAOesGMgrztKFbLM4m3sr1cH=Od6FVy8p2BbEi_X=J_jDhyHBKw@mail.gmail.com>
On 07/31/2013 08:17 PM, Olof Johansson wrote:
> Hi,
>
> On Wed, Jul 31, 2013 at 2:02 AM, Lars-Peter Clausen <lars@metafoo.de> wrote:
>> On 07/31/2013 10:52 AM, Dan Carpenter wrote:
>>>
>>> There is a typo here so we end up using the old freed pointer instead of
>>> the newly allocated one. (If the "n" is zero then the code works,
>>> obviously).
>>>
>>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>>
>>
>> Thanks.
>>
>> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
>>
>> Olof, can you check whether this fixes the crash you see?
>
> Nope.
>
> There's also remaining issues with the code, that patch isn't enough.
> The structure that is krealloced() has a list_head in it, but the list
> isn't moved from the old head to the new one. There's no safe way to
> do that using krealloc, since the old list_head is gone by then, so
> it's probably easest to open-code with kzalloc/memcpy/kfree.
Hm, right I didn't think of that. Maybe it's better to just keep a the widget
list in a separate pointer, so none of the other fields of the kcontrol_data
struct are affected by the krealloc.
- Lars
next prev parent reply other threads:[~2013-07-31 18:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-31 8:52 [patch] ASoC: dapm: using freed pointer in dapm_kcontrol_add_widget() Dan Carpenter
2013-07-31 9:02 ` Lars-Peter Clausen
2013-07-31 18:17 ` Olof Johansson
2013-07-31 18:33 ` Lars-Peter Clausen [this message]
2013-07-31 18:44 ` Lars-Peter Clausen
2013-07-31 20:05 ` Mark Brown
2013-08-01 3:49 ` Olof Johansson
2013-07-31 11:19 ` Mark Brown
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=51F9585F.8060505@metafoo.de \
--to=lars@metafoo.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=olof@lixom.net \
--cc=perex@perex.cz \
--cc=tiwai@suse.de \
/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).