Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1335659
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer |
| Date | 2016-02-16 18:30 +0100 |
| Message-ID | <r2RBM-2tA-11@gated-at.bofh.it> (permalink) |
| References | <r2P6V-Gk-7@gated-at.bofh.it> <r2R8K-21y-11@gated-at.bofh.it> <r2Rs6-2q8-33@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tuesday 16 February 2016 18:10:02 Takashi Iwai wrote:
> diff --git a/include/sound/jack.h b/include/sound/jack.h
> index 23bede121c78..a27c253a3207 100644
> --- a/include/sound/jack.h
> +++ b/include/sound/jack.h
> @@ -99,6 +99,7 @@ void snd_jack_report(struct snd_jack *jack, int status);
> static inline int snd_jack_new(struct snd_card *card, const char *id, int type,
> struct snd_jack **jack, bool initial_kctl, bool phantom_jack)
> {
> + *jack = NULL;
> return 0;
> }
>
> diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c
> index a33234e04d4f..babd3a8864a1 100644
> --- a/sound/pci/hda/hda_jack.c
> +++ b/sound/pci/hda/hda_jack.c
> @@ -403,10 +403,12 @@ 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;
> - state = snd_hda_jack_detect(codec, nid);
> - snd_jack_report(jack->jack, state ? jack->type : 0);
> + if (jack->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);
> + }
>
> return 0;
> }
> diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
> index 8ee78dbd4c60..34a7b3aaba11 100644
> --- a/sound/pci/hda/patch_hdmi.c
> +++ b/sound/pci/hda/patch_hdmi.c
> @@ -2158,8 +2158,10 @@ static int add_acomp_jack_kctl(struct hda_codec *codec,
> if (err < 0)
> return err;
> per_pin->acomp_jack = jack;
> - jack->private_data = per_pin;
> - jack->private_free = free_acomp_jack_priv;
> + if (jack) {
> + jack->private_data = per_pin;
> + jack->private_free = free_acomp_jack_priv;
> + }
> return 0;
> }
>
Looks good to me.
Acked-by: Arnd Bergmann <arnd@arndb.de>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Arnd Bergmann <arnd@arndb.de> - 2016-02-16 15:50 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Takashi Iwai <tiwai@suse.de> - 2016-02-16 16:50 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Arnd Bergmann <arnd@arndb.de> - 2016-02-16 17:20 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Takashi Iwai <tiwai@suse.de> - 2016-02-16 17:20 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Mark Brown <broonie@kernel.org> - 2016-02-16 17:40 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Takashi Iwai <tiwai@suse.de> - 2016-02-16 17:50 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Arnd Bergmann <arnd@arndb.de> - 2016-02-16 18:00 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Arnd Bergmann <arnd@arndb.de> - 2016-02-16 18:20 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Takashi Iwai <tiwai@suse.de> - 2016-02-16 18:20 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Arnd Bergmann <arnd@arndb.de> - 2016-02-16 18:30 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Arnd Bergmann <arnd@arndb.de> - 2016-02-16 23:10 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Takashi Iwai <tiwai@suse.de> - 2016-02-17 10:10 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Takashi Iwai <tiwai@suse.de> - 2016-02-17 10:40 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Arnd Bergmann <arnd@arndb.de> - 2016-02-17 10:50 +0100
csiph-web