aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2020-04-20 09:55:29 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-29 16:31:28 +0200
commitdb737117e97aff0e7bfb13689c8a7ce980ea9564 (patch)
tree1883652122d772adcf5fde32cbc30e78992c6e4a
parenta6db63ba00614992bad1d1dc52bb727cb5daf109 (diff)
downloadlinux-yocto-db737117e97aff0e7bfb13689c8a7ce980ea9564.tar.gz
linux-yocto-db737117e97aff0e7bfb13689c8a7ce980ea9564.tar.bz2
linux-yocto-db737117e97aff0e7bfb13689c8a7ce980ea9564.zip
ALSA: usx2y: Fix potential NULL dereference
commit 7686e3485253635c529cdd5f416fc640abaf076f upstream. The error handling code in usX2Y_rate_set() may hit a potential NULL dereference when an error occurs before allocating all us->urb[]. Add a proper NULL check for fixing the corner case. Reported-by: Lin Yi <teroincn@gmail.com> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20200420075529.27203-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--sound/usb/usx2y/usbusx2yaudio.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c
index 2b833054e3b0..bdb28e0229e6 100644
--- a/sound/usb/usx2y/usbusx2yaudio.c
+++ b/sound/usb/usx2y/usbusx2yaudio.c
@@ -695,6 +695,8 @@ static int usX2Y_rate_set(struct usX2Ydev *usX2Y, int rate)
us->submitted = 2*NOOF_SETRATE_URBS;
for (i = 0; i < NOOF_SETRATE_URBS; ++i) {
struct urb *urb = us->urb[i];
+ if (!urb)
+ continue;
if (urb->status) {
if (!err)
err = -ENODEV;