Skip to contentSkip to conversation

ALSA: usx2y: Fix potential NULL dereference

PATCH New Takashi Iwai 1 participant 1 message Apr 20, 2020 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 sound/usb/usx2y/usbusx2yaudio.c | 2 ++
 1 file changed, 2 insertions(+)
sound/usb/usx2y/usbusx2yaudio.c +2 -0
index 37d290fe9d43..ecaf41265dcd 100644
@@ -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;
Signature · 1 line
2.16.4