From: Wang YanQing Date: Tue, 7 May 2013 03:27:33 +0000 (+0800) Subject: ALSA: HDA: Fix Oops caused by dereference NULL pointer X-Git-Tag: v3.2.46~81 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fcc6acda6626851e42aa3c74d9b8d3dfe49d87d1;p=thirdparty%2Fkernel%2Fstable.git ALSA: HDA: Fix Oops caused by dereference NULL pointer commit 2195b063f6609e4c6268f291683902f25eaf9aa6 upstream. The interrupt handler azx_interrupt will call azx_update_rirb, which may call snd_hda_queue_unsol_event, snd_hda_queue_unsol_event will dereference chip->bus pointer. The problem is we alloc chip->bus in azx_codec_create which will be called after we enable IRQ and enable unsolicited event in azx_probe. This will cause Oops due dereference NULL pointer. I meet it, good luck:) [Rearranged the NULL check before the tracepoint and added another NULL check of bus->workq -- tiwai] Signed-off-by: Wang YanQing Signed-off-by: Takashi Iwai Signed-off-by: Ben Hutchings --- diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 4707b6c9816a6..faabaa53e12a2 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -615,6 +615,9 @@ int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex) struct hda_bus_unsolicited *unsol; unsigned int wp; + if (!bus || !bus->workq) + return 0; + trace_hda_unsol_event(bus, res, res_ex); unsol = bus->unsol; if (!unsol)