Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 16 February 2016 17:59:04 Arnd Bergmann wrote:
> --- a/sound/pci/hda/hda_jack.c
> +++ b/sound/pci/hda/hda_jack.c
> @@ -403,8 +403,10 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid,
>  
>         jack->phantom_jack = !!phantom_jack;
>         jack->type = type;
> -       jack->jack->private_data = jack;
> -       jack->jack->private_free = hda_free_jack_priv;
> +       if (IS_ENABLED(CONFIG_SND_JACK)) {
> +               jack->jack->private_data = jack;
> +               jack->jack->private_free = hda_free_jack_priv;
> +       }
>         state = snd_hda_jack_detect(codec, nid);
>         snd_jack_report(jack->jack, state ? jack->type : 0);
>  

Or another idea: if we pass private_{data,free} into snd_jack_new()
as arguments, the snd_jack structure can become private to
sound/core/jack.c, so we can be sure to never hit this bug
again.

	Arnd
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux