lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yyt/LhNoEEfjly54@pendragon.ideasonboard.com>
Date:   Thu, 22 Sep 2022 00:16:30 +0300
From:   Laurent Pinchart <laurent.pinchart@...asonboard.com>
To:     Ricardo Ribalda <ribalda@...omium.org>
Cc:     Mauro Carvalho Chehab <mchehab@...nel.org>,
        linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
        syzbot <syzkaller@...glegroups.com>
Subject: Re: [PATCH v1 1/1] media: uvc: Handle cameras with invalid
 descriptors

Hi Ricardo,

On Wed, Sep 21, 2022 at 09:51:44AM +0200, Ricardo Ribalda wrote:
> Do you mean something like this?
> 
> diff --git a/drivers/media/usb/uvc/uvc_entity.c
> b/drivers/media/usb/uvc/uvc_entity.c
> index 7c4d2f93d351..66d1f5da4ec7 100644
> --- a/drivers/media/usb/uvc/uvc_entity.c
> +++ b/drivers/media/usb/uvc/uvc_entity.c
> @@ -37,7 +37,7 @@ static int uvc_mc_create_links(struct uvc_video_chain *chain,
>                         continue;
> 
>                 remote = uvc_entity_by_id(chain->dev, entity->baSourceID[i]);
> -               if (remote == NULL)
> +               if (remote == NULL || remote->num_pads == 0)
>                         return -EINVAL;

Yes.

> 
>                 source = (UVC_ENTITY_TYPE(remote) == UVC_TT_STREAMING)
> @@ -46,6 +46,9 @@ static int uvc_mc_create_links(struct uvc_video_chain *chain,
>                 if (source == NULL)
>                         continue;
> 
> +               if (source->num_pads != remote->num_pads)
> +                       return -EINVAL;
> +

But this I would have dropped, as the media_entity num_pads is
initialized from uvc_entity num_pads and neither are changed after.

>                 remote_pad = remote->num_pads - 1;
>                 ret = media_create_pad_link(source, remote_pad,
>                                                sink, i, flags);
> 
> regarding making a new patch, whatever is easier for you ;)
> 
> 
> On Wed, 21 Sept 2022 at 02:53, Laurent Pinchart wrote:
> >
> > 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@...glegroups.com>
> > > Signed-off-by: Ricardo Ribalda <ribalda@...omium.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ