[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1389088562-463-1-git-send-email-ethan.kernel@gmail.com>
Date: Tue, 7 Jan 2014 17:56:02 +0800
From: Ethan Zhao <ethan.kernel@...il.com>
To: hans.verkuil@...co.com, m.chehab@...sung.com,
gregkh@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org, Ethan Zhao <ethan.kernel@...il.com>
Subject: [PATCH] media: gspaca: check pointer against NULL before using it in create_urbs()
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@...il.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)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists