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: <20200907141634.GA3733019@kroah.com>
Date:   Mon, 7 Sep 2020 16:16:34 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Alan Stern <stern@...land.harvard.edu>
Cc:     himadrispandya@...il.com, dvyukov@...gle.com,
        linux-usb@...r.kernel.org, perex@...ex.cz, tiwai@...e.com,
        linux-kernel@...r.kernel.org, marcel@...tmann.org,
        johan.hedberg@...il.com, linux-bluetooth@...r.kernel.org,
        alsa-devel@...a-project.org,
        "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        Eli Billauer <eli.billauer@...il.com>,
        Emiliano Ingrassia <ingrassia@...genesys.com>,
        Alexander Tsoy <alexander@...y.me>,
        "Geoffrey D. Bennett" <g@...vu>, Jussi Laako <jussi@...arnerd.net>,
        Nick Kossifidis <mickflemm@...il.com>,
        Dmitry Panchenko <dmitry@...ystems.ee>,
        Chris Wulff <crwulff@...il.com>,
        Jesus Ramos <jesus-ramos@...e.com>
Subject: Re: [PATCH 01/10] USB: move snd_usb_pipe_sanity_check into the USB
 core

On Thu, Sep 03, 2020 at 09:32:30AM +0200, Greg Kroah-Hartman wrote:
> On Wed, Sep 02, 2020 at 08:45:53PM -0400, Alan Stern wrote:
> > On Wed, Sep 02, 2020 at 01:01:03PM +0200, Greg Kroah-Hartman wrote:
> > > snd_usb_pipe_sanity_check() is a great function, so let's move it into
> > > the USB core so that other parts of the kernel, including the USB core,
> > > can call it.
> > > 
> > > Name it usb_pipe_type_check() to match the existing
> > > usb_urb_ep_type_check() call, which now uses this function.
> > > 
> > > Cc: Jaroslav Kysela <perex@...ex.cz>
> > > Cc: Takashi Iwai <tiwai@...e.com>
> > > Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>
> > > Cc: Eli Billauer <eli.billauer@...il.com>
> > > Cc: Emiliano Ingrassia <ingrassia@...genesys.com>
> > > Cc: Alan Stern <stern@...land.harvard.edu>
> > > Cc: Alexander Tsoy <alexander@...y.me>
> > > Cc: "Geoffrey D. Bennett" <g@...vu>
> > > Cc: Jussi Laako <jussi@...arnerd.net>
> > > Cc: Nick Kossifidis <mickflemm@...il.com>
> > > Cc: Dmitry Panchenko <dmitry@...ystems.ee>
> > > Cc: Chris Wulff <crwulff@...il.com>
> > > Cc: Jesus Ramos <jesus-ramos@...e.com>
> > > Cc: linux-usb@...r.kernel.org
> > > Cc: linux-kernel@...r.kernel.org
> > > Cc: alsa-devel@...a-project.org
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> > > ---
> > 
> > > diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
> > > index 27e83e55a590..45bc2914c1ba 100644
> > > --- a/drivers/usb/core/urb.c
> > > +++ b/drivers/usb/core/urb.c
> > > @@ -192,24 +192,39 @@ static const int pipetypes[4] = {
> > >  };
> > >  
> > >  /**
> > > - * usb_urb_ep_type_check - sanity check of endpoint in the given urb
> > > - * @urb: urb to be checked
> > > + * usb_pipe_type_check - sanity check of a specific pipe for a usb device
> > > + * @dev: struct usb_device to be checked
> > > + * @pipe: pipe to check
> > >   *
> > >   * This performs a light-weight sanity check for the endpoint in the
> > > - * given urb.  It returns 0 if the urb contains a valid endpoint, otherwise
> > > - * a negative error code.
> > > + * given usb device.  It returns 0 if the pipe is a valid for the specific usb
> > -----------------------------------------------------^
> > Typo.
> 
> Oops, will fix, thanks.
> 
> 
> > 
> > > + * device, otherwise a negative error code.
> > >   */
> > > -int usb_urb_ep_type_check(const struct urb *urb)
> > > +int usb_pipe_type_check(struct usb_device *dev, unsigned int pipe)
> > >  {
> > >  	const struct usb_host_endpoint *ep;
> > >  
> > > -	ep = usb_pipe_endpoint(urb->dev, urb->pipe);
> > > +	ep = usb_pipe_endpoint(dev, pipe);
> > >  	if (!ep)
> > >  		return -EINVAL;
> > > -	if (usb_pipetype(urb->pipe) != pipetypes[usb_endpoint_type(&ep->desc)])
> > > +	if (usb_pipetype(pipe) != pipetypes[usb_endpoint_type(&ep->desc)])
> > >  		return -EINVAL;
> > >  	return 0;
> > >  }
> > > +EXPORT_SYMBOL_GPL(usb_pipe_type_check);
> > > +
> > > +/**
> > > + * usb_urb_ep_type_check - sanity check of endpoint in the given urb
> > > + * @urb: urb to be checked
> > > + *
> > > + * This performs a light-weight sanity check for the endpoint in the
> > > + * given urb.  It returns 0 if the urb contains a valid endpoint, otherwise
> > > + * a negative error code.
> > > + */
> > > +int usb_urb_ep_type_check(const struct urb *urb)
> > > +{
> > > +	return usb_pipe_type_check(urb->dev, urb->pipe);
> > > +}
> > >  EXPORT_SYMBOL_GPL(usb_urb_ep_type_check);
> > 
> > Since this routine is used in only one place in the entire kernel, you 
> > might as well inline the code there and get rid of the function 
> > entirely.
> 
> Good idea, will do.

No, wait, the USB sound drivers call it a lot, so it needs to stick
around for now until we clean that up.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ