[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211109221905.1234094-71-sashal@kernel.org>
Date: Tue, 9 Nov 2021 17:19:01 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Chengfeng Ye <cyeaa@...nect.ust.hk>, Takashi Iwai <tiwai@...e.de>,
Sasha Levin <sashal@...nel.org>, perex@...ex.cz,
tiwai@...e.com, alsa-devel@...a-project.org
Subject: [PATCH AUTOSEL 5.14 71/75] ALSA: usb-audio: fix null pointer dereference on pointer cs_desc
From: Chengfeng Ye <cyeaa@...nect.ust.hk>
[ Upstream commit b97053df0f04747c3c1e021ecbe99db675342954 ]
The pointer cs_desc return from snd_usb_find_clock_source could
be null, so there is a potential null pointer dereference issue.
Fix this by adding a null check before dereference.
Signed-off-by: Chengfeng Ye <cyeaa@...nect.ust.hk>
Link: https://lore.kernel.org/r/20211024111736.11342-1-cyeaa@connect.ust.hk
Signed-off-by: Takashi Iwai <tiwai@...e.de>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
sound/usb/clock.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 14456f61539e1..6c3f3312113f6 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -499,6 +499,10 @@ int snd_usb_set_sample_rate_v2v3(struct snd_usb_audio *chip,
union uac23_clock_source_desc *cs_desc;
cs_desc = snd_usb_find_clock_source(chip, clock, fmt->protocol);
+
+ if (!cs_desc)
+ return 0;
+
if (fmt->protocol == UAC_VERSION_3)
bmControls = le32_to_cpu(cs_desc->v3.bmControls);
else
--
2.33.0
Powered by blists - more mailing lists