diff options
author | Takashi Iwai <tiwai@suse.de> | 2017-05-24 11:19:45 +0300 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2017-09-15 20:30:48 +0300 |
commit | 807c3cc057f7f1f0b219d7da47247748a9079687 (patch) | |
tree | 71b3412c5303bf82f3c5cdab86e9fa5382f213bc /drivers/scsi | |
parent | 559211ac7b05b3165cc572f936c1fb82bfdb1fc9 (diff) | |
download | linux-807c3cc057f7f1f0b219d7da47247748a9079687.tar.xz |
ASoC: Fix use-after-free at card unregistration
commit 4efda5f2130da033aeedc5b3205569893b910de2 upstream.
soc_cleanup_card_resources() call snd_card_free() at the last of its
procedure. This turned out to lead to a use-after-free.
PCM runtimes have been already removed via soc_remove_pcm_runtimes(),
while it's dereferenced later in soc_pcm_free() called via
snd_card_free().
The fix is simple: just move the snd_card_free() call to the beginning
of the whole procedure. This also gives another benefit: it
guarantees that all operations have been shut down before actually
releasing the resources, which was racy until now.
Reported-and-tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'drivers/scsi')
0 files changed, 0 insertions, 0 deletions