Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2c6433e authored by Aditya Pakki's avatar Aditya Pakki Committed by Takashi Iwai
Browse files

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: default avatarAditya Pakki <pakki001@umn.edu>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent d344e079
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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) ||