Skip to content

Commit dadefe3

Browse files
jjuhlMauro Carvalho Chehab
authored andcommitted
[media] gspca/stv06xx_pb0100: Don't potentially deref NULL in pb0100_start()
usb_altnum_to_altsetting() may return NULL. If it does we'll dereference a NULL pointer in drivers/media/video/gspca/stv06xx/stv06xx_pb0100.c::pb0100_start(). As far as I can tell there's not really anything more sensible than -ENODEV that we can return in that situation, but I'm not at all intimate with this code so I'd like a bit of review/comments on this before it's applied. Anyway, here's a proposed patch. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Cc: Jean-Francois Moine <moinejf@free.fr> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Erik Andren <erik.andren@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
1 parent 488ebc4 commit dadefe3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/media/video/gspca/stv06xx/stv06xx_pb0100.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ static int pb0100_start(struct sd *sd)
217217

218218
intf = usb_ifnum_to_if(sd->gspca_dev.dev, sd->gspca_dev.iface);
219219
alt = usb_altnum_to_altsetting(intf, sd->gspca_dev.alt);
220+
if (!alt)
221+
return -ENODEV;
220222
packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize);
221223

222224
/* If we don't have enough bandwidth use a lower framerate */

0 commit comments

Comments
 (0)