linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: gspaca: check pointer against NULL before using it in create_urbs()
@ 2014-01-07  9:56 Ethan Zhao
  0 siblings, 0 replies; only message in thread
From: Ethan Zhao @ 2014-01-07  9:56 UTC (permalink / raw)
  To: hans.verkuil, m.chehab, gregkh; +Cc: linux-kernel, Ethan Zhao

function alt_xfer() may return NULL, should check its return value passed into
create_urbs() as parameter.

gspca_init_transfer()
{
... ...
ret = create_urbs(gspca_dev,alt_xfer(&intf->altsetting[alt], xfer));
... ...
}

Signed-off-by: Ethan Zhao <ethan.kernel@gmail.com>
---
 drivers/media/usb/gspca/gspca.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
index 048507b..eb45bc0 100644
--- a/drivers/media/usb/gspca/gspca.c
+++ b/drivers/media/usb/gspca/gspca.c
@@ -761,6 +761,8 @@ static int create_urbs(struct gspca_dev *gspca_dev,
 	struct urb *urb;
 	int n, nurbs, i, psize, npkt, bsize;
 
+	if (!ep)
+		return -EINVAL;
 	/* calculate the packet size and the number of packets */
 	psize = le16_to_cpu(ep->desc.wMaxPacketSize);
 
-- 
1.8.3.4 (Apple Git-47)


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-01-07  9:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-07  9:56 [PATCH] media: gspaca: check pointer against NULL before using it in create_urbs() Ethan Zhao

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).