Skip to content

Commit

Permalink
ALSA: HDA: Fix Oops caused by dereference NULL pointer
Browse files Browse the repository at this point in the history
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 <udknight@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Wang YanQing authored and Takashi Iwai committed May 7, 2013
1 parent 5a4ca9b commit 2195b06
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sound/pci/hda/hda_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,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)
Expand Down

0 comments on commit 2195b06

Please sign in to comment.