]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ALSA: hda - Fix bad dereference of jack object
authorTakashi Iwai <tiwai@suse.de>
Tue, 9 Feb 2016 09:23:52 +0000 (10:23 +0100)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 26 May 2016 22:45:00 +0000 (15:45 -0700)
commit1b2de604788f584b49a5f6539e8ebc7bb5e4df94
treec6ccf8c0c632b24ac504f47a2ce67830d5fec7e2
parentc901d5f4ff137a2550fc3d3cbfccae1e8b22a64c
ALSA: hda - Fix bad dereference of jack object

Orabug: 23330852

[ Upstream commit 2ebab40eb74a0225d5dfba72bfae317dd948fa2d ]

The hda_jack_tbl entries are managed by snd_array for allowing
multiple jacks.  It's good per se, but the problem is that struct
hda_jack_callback keeps the hda_jack_tbl pointer.  Since snd_array
doesn't preserve each pointer at resizing the array, we can't keep the
original pointer but have to deduce the pointer at each time via
snd_array_entry() instead.  Actually, this resulted in the deference
to the wrong pointer on codecs that have many pins such as CS4208.

This patch replaces the pointer to the NID value as the search key.
As an unexpected good side effect, this even simplifies the code, as
only NID is needed in most cases.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
(cherry picked from commit dbe8ccc27ee453e435597e636b4c7445fdc8c6d5)

Signed-off-by: Dan Duval <dan.duval@oracle.com>
sound/pci/hda/hda_generic.c
sound/pci/hda/hda_jack.c
sound/pci/hda/hda_jack.h
sound/pci/hda/patch_ca0132.c
sound/pci/hda/patch_hdmi.c
sound/pci/hda/patch_realtek.c
sound/pci/hda/patch_sigmatel.c