Skip to content

Commit 7686e34

Browse files
committed
ALSA: usx2y: Fix potential NULL dereference
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 <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 6f4ea20 commit 7686e34

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sound/usb/usx2y/usbusx2yaudio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,8 @@ static int usX2Y_rate_set(struct usX2Ydev *usX2Y, int rate)
681681
us->submitted = 2*NOOF_SETRATE_URBS;
682682
for (i = 0; i < NOOF_SETRATE_URBS; ++i) {
683683
struct urb *urb = us->urb[i];
684+
if (!urb)
685+
continue;
684686
if (urb->status) {
685687
if (!err)
686688
err = -ENODEV;

0 commit comments

Comments
 (0)