From: Chengfeng Ye <cyeaa@connect.ust.hk>
To: perex@perex.cz, tiwai@suse.com, chihhao.chen@mediatek.com,
damien@zamaudio.com
Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
Chengfeng Ye <cyeaa@connect.ust.hk>
Subject: [PATCH] sound/usb: fix null pointer dereference on pointer cs_desc
Date: Sun, 24 Oct 2021 04:17:36 -0700 [thread overview]
Message-ID: <20211024111736.11342-1-cyeaa@connect.ust.hk> (raw)
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.
Fixes: 9ec73005 ("ALSA: usb-audio: Refactoring UAC2/3 clock setup code")
Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
---
sound/usb/clock.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 81d5ce07d548..98345a695dcc 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -496,6 +496,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.17.1
next reply other threads:[~2021-10-24 11:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-24 11:17 Chengfeng Ye [this message]
[not found] ` <TYCP286MB1188D80DA04A5EE1B96814B28A829@TYCP286MB1188.JPNP286.PROD.OUTLOOK.COM>
2021-10-26 6:10 ` 回复: " Takashi Iwai
2021-10-26 12:51 ` 回复: " YE Chengfeng
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=20211024111736.11342-1-cyeaa@connect.ust.hk \
--to=cyeaa@connect.ust.hk \
--cc=alsa-devel@alsa-project.org \
--cc=chihhao.chen@mediatek.com \
--cc=damien@zamaudio.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/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
all inboxes | Powered by JetHome®