]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ALSA: hda - Fix Oops at codec reset/reconfig
authorTakashi Iwai <tiwai@suse.de>
Mon, 10 Sep 2012 07:39:31 +0000 (09:39 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 19 Sep 2012 14:05:19 +0000 (15:05 +0100)
commit 07dc59f0988cb54fd87bd373b3b27eb2401dd811 upstream.

snd_hda_codec_reset() calls restore_pincfgs() where the codec is
powered up again, which eventually tries to resume and initialize via
the callbacks of the codec.  However, it's the place just after codec
free callback, thus no codec callbacks should be called after that.
On a codec like CS4206, it results in Oops due to the access in init
callback.

This patch fixes the issue by clearing the codec callbacks properly
after freeing codec.

Reported-by: Daniel J Blueman <daniel@quora.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
sound/pci/hda/hda_codec.c

index f3be54e5f6e8cf556fe6fb2ed4604426e392736c..b0187e7d046eae80533951645188ac577a80f47e 100644 (file)
@@ -2312,6 +2312,7 @@ int snd_hda_codec_reset(struct hda_codec *codec)
        }
        if (codec->patch_ops.free)
                codec->patch_ops.free(codec);
+       memset(&codec->patch_ops, 0, sizeof(codec->patch_ops));
        codec->proc_widget_hook = NULL;
        codec->spec = NULL;
        free_hda_cache(&codec->amp_cache);
@@ -2324,7 +2325,6 @@ int snd_hda_codec_reset(struct hda_codec *codec)
        codec->num_pcms = 0;
        codec->pcm_info = NULL;
        codec->preset = NULL;
-       memset(&codec->patch_ops, 0, sizeof(codec->patch_ops));
        codec->slave_dig_outs = NULL;
        codec->spdif_status_reset = 0;
        module_put(codec->owner);