linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: flexcop-usb: fix endpoint type check
@ 2022-06-09 13:53 Johan Hovold
  2022-07-11  9:49 ` Johan Hovold
  0 siblings, 1 reply; 2+ messages in thread
From: Johan Hovold @ 2022-06-09 13:53 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Hans Verkuil
  Cc: Sean Young, linux-media, linux-kernel, Johan Hovold,
	Oliver Neukum, stable, Dongliang Mu

Commit d725d20e81c2 ("media: flexcop-usb: sanity checking of endpoint
type") tried to add an endpoint type sanity check for the single
isochronous endpoint but instead broke the driver by checking the wrong
descriptor or random data beyond the last endpoint descriptor.

Make sure to check the right endpoint descriptor.

Fixes: d725d20e81c2 ("media: flexcop-usb: sanity checking of endpoint type")
Cc: Oliver Neukum <oneukum@suse.com>
Cc: stable@vger.kernel.org	# 5.9
Reported-by: Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/media/usb/b2c2/flexcop-usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c
index 7835bb0f32fc..e012b21c4fd7 100644
--- a/drivers/media/usb/b2c2/flexcop-usb.c
+++ b/drivers/media/usb/b2c2/flexcop-usb.c
@@ -511,7 +511,7 @@ static int flexcop_usb_init(struct flexcop_usb *fc_usb)
 
 	if (fc_usb->uintf->cur_altsetting->desc.bNumEndpoints < 1)
 		return -ENODEV;
-	if (!usb_endpoint_is_isoc_in(&fc_usb->uintf->cur_altsetting->endpoint[1].desc))
+	if (!usb_endpoint_is_isoc_in(&fc_usb->uintf->cur_altsetting->endpoint[0].desc))
 		return -ENODEV;
 
 	switch (fc_usb->udev->speed) {
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: flexcop-usb: fix endpoint type check
  2022-06-09 13:53 [PATCH] media: flexcop-usb: fix endpoint type check Johan Hovold
@ 2022-07-11  9:49 ` Johan Hovold
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2022-07-11  9:49 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Hans Verkuil
  Cc: Sean Young, linux-media, linux-kernel, Oliver Neukum, stable,
	Dongliang Mu

On Thu, Jun 09, 2022 at 03:53:41PM +0200, Johan Hovold wrote:
> Commit d725d20e81c2 ("media: flexcop-usb: sanity checking of endpoint
> type") tried to add an endpoint type sanity check for the single
> isochronous endpoint but instead broke the driver by checking the wrong
> descriptor or random data beyond the last endpoint descriptor.
> 
> Make sure to check the right endpoint descriptor.
> 
> Fixes: d725d20e81c2 ("media: flexcop-usb: sanity checking of endpoint type")
> Cc: Oliver Neukum <oneukum@suse.com>
> Cc: stable@vger.kernel.org	# 5.9
> Reported-by: Dongliang Mu <mudongliangabcd@gmail.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---

I haven't received any notification about this one being added to any
tree and the status is still set to "NEW" in the patch tracker so
sending a reminder.

>  drivers/media/usb/b2c2/flexcop-usb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c
> index 7835bb0f32fc..e012b21c4fd7 100644
> --- a/drivers/media/usb/b2c2/flexcop-usb.c
> +++ b/drivers/media/usb/b2c2/flexcop-usb.c
> @@ -511,7 +511,7 @@ static int flexcop_usb_init(struct flexcop_usb *fc_usb)
>  
>  	if (fc_usb->uintf->cur_altsetting->desc.bNumEndpoints < 1)
>  		return -ENODEV;
> -	if (!usb_endpoint_is_isoc_in(&fc_usb->uintf->cur_altsetting->endpoint[1].desc))
> +	if (!usb_endpoint_is_isoc_in(&fc_usb->uintf->cur_altsetting->endpoint[0].desc))
>  		return -ENODEV;
>  
>  	switch (fc_usb->udev->speed) {

Johan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-11 10:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-09 13:53 [PATCH] media: flexcop-usb: fix endpoint type check Johan Hovold
2022-07-11  9:49 ` Johan Hovold

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