1
0
Fork 0

ALSA: usx2y: Fix potential NULL dereference

commit 7686e34852 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>
5.4-rM2-2.2.x-imx-squashed
Takashi Iwai 2020-04-20 09:55:29 +02:00 committed by Greg Kroah-Hartman
parent 000515184f
commit 16e373fe61
1 changed files with 2 additions and 0 deletions

View File

@ -681,6 +681,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;