path: root/sound
diff options
authorAditya Pakki <pakki001@umn.edu>2019-03-04 17:00:02 -0600
committerTakashi Iwai <tiwai@suse.de>2019-03-13 11:27:06 +0100
commita2c6433ee5a35a8de6d563f6512a26f87835ea0f (patch)
tree800f577e386fb939b01b35316db3a5b3adbf3f69 /sound
parentd344e07940f3a3a93dec38f36593cca1591a7a5e (diff)
ALSA: usx2y: Fix potential NULL pointer dereference
usb_alloc_urb() can fail due to kmalloc failure and push the error upstream. Further this can cause a NULL pointer dereference in init_pipe_urbs(). This patch avoids such a scenario. Signed-off-by: Aditya Pakki <pakki001@umn.edu> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/usb/usx2y/usb_stream.c b/sound/usb/usx2y/usb_stream.c
index b0f8979ff2d2..221adf68bd0c 100644
--- a/sound/usb/usx2y/usb_stream.c
+++ b/sound/usb/usx2y/usb_stream.c
@@ -104,7 +104,12 @@ static int init_urbs(struct usb_stream_kernel *sk, unsigned use_packsize,
for (u = 0; u < USB_STREAM_NURBS; ++u) {
sk->inurb[u] = usb_alloc_urb(sk->n_o_ps, GFP_KERNEL);
+ if (!sk->inurb[u])
+ return -ENOMEM;
sk->outurb[u] = usb_alloc_urb(sk->n_o_ps, GFP_KERNEL);
+ if (!sk->outurb[u])
+ return -ENOMEM;
if (init_pipe_urbs(sk, use_packsize, sk->inurb, indata, dev, in_pipe) ||