Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Takashi Iwai <tiwai@suse.de>, Sasha Levin <sashal@kernel.org>,
	perex@perex.cz, tiwai@suse.com, linux-sound@vger.kernel.org
Subject: [PATCH AUTOSEL 6.11 105/244] ALSA: asihpi: Fix potential OOB array access
Date: Wed, 25 Sep 2024 07:25:26 -0400	[thread overview]
Message-ID: <20240925113641.1297102-105-sashal@kernel.org> (raw)
In-Reply-To: <20240925113641.1297102-1-sashal@kernel.org>

From: Takashi Iwai <tiwai@suse.de>

[ Upstream commit 7b986c7430a6bb68d523dac7bfc74cbd5b44ef96 ]

ASIHPI driver stores some values in the static array upon a response
from the driver, and its index depends on the firmware.  We shouldn't
trust it blindly.

This patch adds a sanity check of the array index to fit in the array
size.

Link: https://patch.msgid.link/20240808091454.30846-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/pci/asihpi/hpimsgx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/asihpi/hpimsgx.c b/sound/pci/asihpi/hpimsgx.c
index d0caef2994818..b68e6bfbbfbab 100644
--- a/sound/pci/asihpi/hpimsgx.c
+++ b/sound/pci/asihpi/hpimsgx.c
@@ -708,7 +708,7 @@ static u16 HPIMSGX__init(struct hpi_message *phm,
 		phr->error = HPI_ERROR_PROCESSING_MESSAGE;
 		return phr->error;
 	}
-	if (hr.error == 0) {
+	if (hr.error == 0 && hr.u.s.adapter_index < HPI_MAX_ADAPTERS) {
 		/* the adapter was created successfully
 		   save the mapping for future use */
 		hpi_entry_points[hr.u.s.adapter_index] = entry_point_func;
-- 
2.43.0


  parent reply	other threads:[~2024-09-25 11:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240925113641.1297102-1-sashal@kernel.org>
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 088/244] ALSA: usb-audio: Add input value sanity checks for standard types Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 091/244] ALSA: usb-audio: Support multiple control interfaces Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 092/244] ALSA: usb-audio: Define macros for quirk table entries Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 093/244] ALSA: usb-audio: Replace complex quirk lines with macros Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 094/244] ALSA: usb-audio: Add quirk for RME Digiface USB Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 095/244] ALSA: usb-audio: Add mixer " Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 096/244] ALSA: hda/realtek: Refactor and simplify Samsung Galaxy Book init Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 097/244] ALSA: usb-audio: Add logitech Audio profile quirk Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 098/244] ASoC: codecs: wsa883x: Handle reading version failure Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 099/244] ALSA: control: Take power_ref lock primarily Sasha Levin
2024-09-25 11:25 ` Sasha Levin [this message]
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 106/244] ALSA: hdsp: Break infinite MIDI input flush loop Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 109/244] ASoC: soc-pcm: Indicate warning if dpcm_playback/capture were used for availability limition Sasha Levin
2024-09-25 12:13   ` Mark Brown
2024-10-06  0:29     ` Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 111/244] ASoC: Intel: boards: always check the result of acpi_dev_get_first_match_dev() Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240925113641.1297102-105-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox