From: Takashi Iwai <tiwai@suse.de>
To: Richard Fitzgerald <rf@opensource.cirrus.com>
Cc: <tiwai@suse.com>, <linux-kernel@vger.kernel.org>,
<patches@opensource.cirrus.com>, <alsa-devel@alsa-project.org>,
<linux-sound@vger.kernel.org>
Subject: Re: [PATCH] ALSA: hda/cs_dsp_ctl: Use private_free for control cleanup
Date: Wed, 08 May 2024 14:33:53 +0200 [thread overview]
Message-ID: <875xvocwjy.wl-tiwai@suse.de> (raw)
In-Reply-To: <20240508095627.44476-1-rf@opensource.cirrus.com>
On Wed, 08 May 2024 11:56:27 +0200,
Richard Fitzgerald wrote:
>
> Use the control private_free callback to free the associated data
> block. This ensures that the memory won't leak, whatever way the
> control gets destroyed.
>
> The original implementation didn't actually remove the ALSA
> controls in hda_cs_dsp_control_remove(). It only freed the internal
> tracking structure. This meant it was possible to remove/unload the
> amp driver while leaving its ALSA controls still present in the
> soundcard. Obviously attempting to access them could cause segfaults
> or at least dereferencing stale pointers.
>
> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
> Fixes: 3233b978af23 ("ALSA: hda: hda_cs_dsp_ctl: Add Library to support CS_DSP ALSA controls")
> ---
> This replaces my earlier "keep it simple" attempt at cleanup.
> I decided that implementing private_free is the only sensible
> way to fix the cleanup.
Applied now. Thanks.
Takashi
prev parent reply other threads:[~2024-05-08 12:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-08 9:56 [PATCH] ALSA: hda/cs_dsp_ctl: Use private_free for control cleanup Richard Fitzgerald
2024-05-08 12:33 ` Takashi Iwai [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=875xvocwjy.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=rf@opensource.cirrus.com \
--cc=tiwai@suse.com \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).