* [PATCH] ALSA: usx2y: Fix potential NULL pointer dereference
@ 2019-03-04 23:00 Aditya Pakki
2019-03-13 10:27 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Aditya Pakki @ 2019-03-04 23:00 UTC (permalink / raw)
To: pakki001; +Cc: kjlu, Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel
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>
---
sound/usb/usx2y/usb_stream.c | 5 +++++
1 file changed, 5 insertions(+)
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) ||
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-13 10:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-04 23:00 [PATCH] ALSA: usx2y: Fix potential NULL pointer dereference Aditya Pakki
2019-03-13 10:27 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).