]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: hda: Hardening for potential Spectre v1
authorTakashi Iwai <tiwai@suse.de>
Tue, 24 Apr 2018 05:50:50 +0000 (07:50 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 25 Apr 2018 08:37:46 +0000 (10:37 +0200)
commita05fada1d4b61962d237c61ab056154928cb107f
treef8955b74773bf46e93e0e8c8293d59800504e1b4
parent2cbb7c2c61cf5390a1740c6edd68932e9dcced90
ALSA: hda: Hardening for potential Spectre v1

As recently Smatch suggested, one place in HD-audio hwdep ioctl codes
may expand the array directly from the user-space value with
speculation:
  sound/pci/hda/hda_local.h:467 get_wcaps() warn: potential spectre issue 'codec->wcaps'

As get_wcaps() itself is a fairly frequently called inline function,
and there is only one single call with a user-space value, we replace
only the latter one to open-code locally with array_index_nospec()
hardening in this patch.

BugLink: https://marc.info/?l=linux-kernel&m=152411496503418&w=2
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_hwdep.c