mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzbot <syzkaller@googlegroups.com>
Subject: Re: [PATCH v1 1/1] media: uvc: Handle cameras with invalid descriptors
Date: Wed, 21 Sep 2022 03:53:31 +0300	[thread overview]
Message-ID: <Yypgi6Jc9/tZLtIw@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20220920-invalid-desc-v1-1-76a93174f3bc@chromium.org>

Hi Ricardo,

Thank you for the patch.

On Tue, Sep 20, 2022 at 04:04:55PM +0200, Ricardo Ribalda wrote:
> If the source entity does not contain any pads, do not create a link.
> 
> Reported-by: syzbot <syzkaller@googlegroups.com>
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> 
> diff --git a/drivers/media/usb/uvc/uvc_entity.c b/drivers/media/usb/uvc/uvc_entity.c
> index 7c4d2f93d351..1f730cb72e58 100644
> --- a/drivers/media/usb/uvc/uvc_entity.c
> +++ b/drivers/media/usb/uvc/uvc_entity.c
> @@ -43,7 +43,7 @@ static int uvc_mc_create_links(struct uvc_video_chain *chain,
>  		source = (UVC_ENTITY_TYPE(remote) == UVC_TT_STREAMING)
>  		       ? (remote->vdev ? &remote->vdev->entity : NULL)
>  		       : &remote->subdev.entity;
> -		if (source == NULL)
> +		if (source == NULL || source->num_pads == 0)

source->num_pads and remote->num_pads should always be identical, but as
the next line uses remote->num_pads, wouldn't it be better to test that
variable ? If so, I'd move the test a file lines earlier, with the
remote == NULL test.

What do you think ? If you agree I can make that change when applying,
there's no need for a new version. Otherwise I'll keep the patch as-is.

>  			continue;
>  
>  		remote_pad = remote->num_pads - 1;
> 

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2022-09-21  0:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20 14:04 [PATCH v1 0/1] [RESEND] uvc: Handle cames " Ricardo Ribalda
2022-09-20 14:04 ` [PATCH v1 1/1] media: uvc: Handle cameras " Ricardo Ribalda
2022-09-21  0:53   ` Laurent Pinchart [this message]
2022-09-21  7:51     ` Ricardo Ribalda
2022-09-21 21:16       ` Laurent Pinchart
2022-09-21 21:52         ` Ricardo Ribalda
2022-10-24 18:18           ` Laurent Pinchart
2023-01-03 14:55             ` Ricardo Ribalda
2023-01-03 20:54               ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yypgi6Jc9/tZLtIw@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ribalda@chromium.org \
    --cc=syzkaller@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®