diff options
author | Jaroslav Kysela <perex@perex.cz> | 2023-01-13 09:53:11 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2023-01-13 09:54:55 +0100 |
commit | 92a9c0ad86d47ff4cce899012e355c400f02cfb8 (patch) | |
tree | 60f5a1fdd895a137cdf8d94bd19c94bf083a06fa /sound/usb/pcm.c | |
parent | Merge tag 'asoc-fix-v6.2-rc3' of https://git.kernel.org/pub/scm/linux/kernel/... (diff) | |
download | linux-92a9c0ad86d47ff4cce899012e355c400f02cfb8.tar.xz linux-92a9c0ad86d47ff4cce899012e355c400f02cfb8.zip |
ALSA: usb-audio: Fix possible NULL pointer dereference in snd_usb_pcm_has_fixed_rate()
The subs function argument may be NULL, so do not use it before the NULL check.
Fixes: 291e9da91403 ("ALSA: usb-audio: Always initialize fixed_rate in snd_usb_find_implicit_fb_sync_format()")
Reported-by: coverity-bot <keescook@chromium.org>
Link: https://lore.kernel.org/alsa-devel/202301121424.4A79A485@keescook/
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230113085311.623325-1-perex@perex.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/pcm.c')
-rw-r--r-- | sound/usb/pcm.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 1f72960d0d53..d959da7a1afb 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c @@ -160,11 +160,12 @@ find_substream_format(struct snd_usb_substream *subs, bool snd_usb_pcm_has_fixed_rate(struct snd_usb_substream *subs) { const struct audioformat *fp; - struct snd_usb_audio *chip = subs->stream->chip; + struct snd_usb_audio *chip; int rate = -1; if (!subs) return false; + chip = subs->stream->chip; if (!(chip->quirk_flags & QUIRK_FLAG_FIXED_RATE)) return false; list_for_each_entry(fp, &subs->fmt_list, list) { |