* [PATCH]ALSA: HDA: Fix Oops caused by dereference NULL pointer
@ 2013-05-07 3:27 Wang YanQing
2013-05-07 5:34 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Wang YanQing @ 2013-05-07 3:27 UTC (permalink / raw)
To: tiwai; +Cc: alsa-devel, linux-kernel, perex, david.henningsson
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:)
Signed-off-by: Wang YanQing <udknight@gmail.com>
---
sound/pci/hda/hda_codec.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 622f726..9c76752 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -618,6 +618,9 @@ int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex)
unsigned int wp;
trace_hda_unsol_event(bus, res, res_ex);
+ if (!bus)
+ return 0;
+
unsol = bus->unsol;
if (!unsol)
return 0;
--
1.7.12.4.dirty
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH]ALSA: HDA: Fix Oops caused by dereference NULL pointer
2013-05-07 3:27 [PATCH]ALSA: HDA: Fix Oops caused by dereference NULL pointer Wang YanQing
@ 2013-05-07 5:34 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2013-05-07 5:34 UTC (permalink / raw)
To: Wang YanQing; +Cc: alsa-devel, linux-kernel, perex, david.henningsson
At Tue, 7 May 2013 11:27:33 +0800,
Wang YanQing wrote:
>
> 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:)
>
> Signed-off-by: Wang YanQing <udknight@gmail.com>
Thanks, applied with a slight fix (put before the tracepoint so that
it won't give more NULL dereference, and also put another NULL check
of bus->workq as done in hda_intel.c.)
Takashi
> ---
> sound/pci/hda/hda_codec.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
> index 622f726..9c76752 100644
> --- a/sound/pci/hda/hda_codec.c
> +++ b/sound/pci/hda/hda_codec.c
> @@ -618,6 +618,9 @@ int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex)
> unsigned int wp;
>
> trace_hda_unsol_event(bus, res, res_ex);
> + if (!bus)
> + return 0;
> +
> unsol = bus->unsol;
> if (!unsol)
> return 0;
> --
> 1.7.12.4.dirty
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-05-07 5:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-07 3:27 [PATCH]ALSA: HDA: Fix Oops caused by dereference NULL pointer Wang YanQing
2013-05-07 5:34 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox