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]
Date:   Thu, 9 Jun 2022 16:00:10 +0200
From:   Johan Hovold <johan@...nel.org>
To:     Dongliang Mu <mudongliangabcd@...il.com>
Cc:     Dongliang Mu <dzm91@...t.edu.cn>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        gushengxian <gushengxian@...ong.com>,
        Hans Verkuil <hverkuil-cisco@...all.nl>,
        Oliver Neukum <oneukum@...e.com>, Sean Young <sean@...s.org>,
        Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
        linux-media@...r.kernel.org,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] media: flexcop-usb: fix sanity check of bNumEndpoints

On Thu, Jun 09, 2022 at 09:42:15AM +0800, Dongliang Mu wrote:
> On Thu, Jun 2, 2022 at 2:45 PM Johan Hovold <johan@...nel.org> wrote:
> >
> > On Thu, Jun 02, 2022 at 01:50:24PM +0800, Dongliang Mu wrote:
> > > From: Dongliang Mu <mudongliangabcd@...il.com>
> > >
> > > Commit d725d20e81c2 ("media: flexcop-usb: sanity checking of endpoint type
> > > ") adds a sanity check for endpoint[1], but fails to modify the sanity
> > > check of bNumEndpoints.
> > >
> > > Fix this by modifying the sanity check of bNumEndpoints to 2.
> >
> > Are you sure that d725d20e81c2 ("media: flexcop-usb: sanity checking of
> > endpoint type) was correct?
> 
> I am not sure if fc_usb->uintf->cur_altsetting->endpoint[1] is right or not.
> 
> But the sanity check of bNumEndpoints does not match the following dereference.

I should know better than try to be subtle on the internet: Your fix is
wrong.

You need to try to understand the code you're changing. Not just do
pattern matching.

> > > Fixes: d725d20e81c2 ("media: flexcop-usb: sanity checking of endpoint type")
> > > Signed-off-by: Dongliang Mu <mudongliangabcd@...il.com>
> > > ---
> > >  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..eb54bfdda01f 100644
> > > --- a/drivers/media/usb/b2c2/flexcop-usb.c
> > > +++ b/drivers/media/usb/b2c2/flexcop-usb.c
> > > @@ -509,7 +509,7 @@ static int flexcop_usb_init(struct flexcop_usb *fc_usb)
> > >               return ret;
> > >       }
> > >
> > > -     if (fc_usb->uintf->cur_altsetting->desc.bNumEndpoints < 1)
> > > +     if (fc_usb->uintf->cur_altsetting->desc.bNumEndpoints < 2)
> > >               return -ENODEV;
> > >       if (!usb_endpoint_is_isoc_in(&fc_usb->uintf->cur_altsetting->endpoint[1].desc))
> > >               return -ENODEV;
> >
> > It looks like it should have verified the type of endpoint[0] here
> > instead.
> 
> This sanity check originally makes sure the
> fc_usb->uintf->cur_altsetting->endpoint[0] in
> flexcop_usb_transfer_init.

Yes, and that is the only endpoint that this driver uses.

I've posted a fix here:

	https://lore.kernel.org/r/20220609135341.19941-1-johan@kernel.org

Johan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ