[alsa-devel] [BUG] NULL pointer dereference in patch_sigmatel.c

Takashi Iwai tiwai at suse.de
Fri Aug 7 12:49:34 CEST 2009


At Fri, 07 Aug 2009 13:36:46 +0300,
Ozan Çağlayan wrote:
> 
> Takashi Iwai wrote On 07-08-2009 12:56:
> > At Fri, 7 Aug 2009 10:43:07 +0100,
> > James Courtier-Dutton wrote:
> >   
> >> 2009/8/7 Ozan Çağlayan <ozan at pardus.org.tr>:
> >>     
> >>> Added the following lines:
> >>>
> >>> printk(KERN_INFO "0x%p\n", jack);
> >>> printk(KERN_INFO "0x%p\n", jack->jack);
> >>> printk(KERN_INFO "0x%p\n", jack->jack->private_data);
> >>>
> >>> dmesg:
> >>>
> >>> NVRM: loading NVIDIA UNIX x86 Kernel Module  180.51  Thu Apr 16 19:02:15
> >>> PDT 2009
> >>> ACPI: PCI Interrupt 0000:00:1b.0[A] -> GSI 22 (level, low) -> IRQ 22
> >>> PCI: Setting latency timer of device 0000:00:1b.0 to 64
> >>> 0xf777a614
> >>> 0x00000000
> >>> BUG: unable to handle kernel NULL pointer dereference at 00000074
> >>> IP: [<f93f2d97>] :snd_hda_codec_conexant:conexant_add_jack+0x57/0x81
> >>> *pde = 00000000·
> >>> Oops: 0000 [#1] SMP
> >>>
> >>>       
> >> Need more of the dmesg output.
> >> I.e. to see which print statements succeeded.
> >> Alternatively, attach the snd_hda.ko so one can see where in that file
> >> offset 0x57 is.
> >> But a more useful print would be:
> >> if (!jack) printk(KERN_INFO "jack null\n");
> >> else if (!(jack->jack)) printk(KERN_INFO "jack->jack null\n");
> >> else if (!(jack->jack->private_data)) printk(KERN_INFO
> >> "jack->jack->private_data null\n");
> >>     
> >
> > Well, it's fairly obvious that jack->jack is NULL as the second
> > output is NULL, and the third one hits Oops.
> >
> > Ozan, could you check whether CONFIG_SND_JACK is set in
> > stac92xx_add_jack, e.g. like below?
> >
> >   
> Nope it seems that it's not set as the #error pragma is executed. I
> looked into the configure script and found the following:
> 
>   if alsa_check_kconfig_option "hda-input-jack"; then
>     if ( test "$CONFIG_SND_PCI" = "y" -o "$CONFIG_SND_PCI" = "m" ) &&
>       ( test "$CONFIG_SND_HDA_INTEL" = "y" -o "$CONFIG_SND_HDA_INTEL" =
> "m" ) &&
>       ( test "$CONFIG_INPUT" = "y" -o "$CONFIG_INPUT" = "m" ); then
>       test "$kversion.$kpatchlevel" = "2.6" -a $ksublevel -ge 27 &&
> CONFIG_SND_JACK="y"
>       CONFIG_SND_HDA_INPUT_JACK="y"
>   fi
> 
> SND_JACK is set if sublevel >= 27 but SND_HDA_INPUT_JACK is set
> regardless of anything. Why the lower limit is 27 for that functionality?

Because of kernel API change, it can't be built with older kernels.

The patch below should fix the problem.  Give it a try.


thanks,

Takashi

---
diff --git a/include/config.h.in b/include/config.h.in
index 5c7a96c..eefc0ee 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -88,3 +88,8 @@
 #undef CONFIG_HAVE_GFP_DMA32
 #undef CONFIG_HAVE_PAGE_TO_PFN
 #undef CONFIG_HAVE_VIDEO_DRVDATA
+
+/* hack - CONFIG_SND_HDA_INPUT_JACK can be wrongly set for older kernels */
+#ifndef CONFIG_SND_JACK
+#undef CONFIG_SND_HDA_INPUT_JACK
+#endif


More information about the Alsa-devel mailing list