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: <87ziuyqvxv.fsf@ti.com>
Date:	Thu, 18 Feb 2016 10:11:56 +0200
From:	Felipe Balbi <balbif@...il.com>
To:	Marek Szyprowski <m.szyprowski@...sung.com>,
	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:	Marek Szyprowski <m.szyprowski@...sung.com>,
	Ruslan Bilovol <ruslan.bilovol@...il.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
	Vegard Nossum <vegard.nossum@...cle.com>,
	Maxime Ripard <maxime.ripard@...e-electrons.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Peter Chen <peter.chen@...escale.com>,
	Felipe Balbi <balbi@...nel.org>
Subject: Re: [PATCH v2 RESEND] usb: gadget: provide interface for legacy gadgets to get UDC name


Hi,

Marek Szyprowski <m.szyprowski@...sung.com> writes:
> Since commit 855ed04a3758b205e84b269f92d26ab36ed8e2f7 ("usb: gadget:
> udc-core: independent registration of gadgets and gadget drivers") gadget
> drivers can not assume that UDC drivers are already available on their
> initialization. This broke the HACK, which was used in gadgetfs driver,
> to get UDC controller name. This patch removes this hack and replaces it
> by additional function in the UDC core (which is usefully only for legacy
> drivers, please don't use it in the new code).
>
> Reported-by: Vegard Nossum <vegard.nossum@...cle.com>
> Signed-off-by: Marek Szyprowski <m.szyprowski@...sung.com>
> Tested-by: Vegard Nossum <vegard.nossum@...cle.com>
> ---
> changelog:
> v2:
> - properly report udc gagdet driver name instead of udc device name
>
> v1: https://lkml.org/lkml/2016/2/8/176
> - initial version
> ---
>  drivers/usb/gadget/legacy/inode.c | 29 ++---------------------------
>  drivers/usb/gadget/udc/udc-core.c | 33 +++++++++++++++++++++++++++++++++
>  include/linux/usb/gadget.h        |  1 +
>  3 files changed, 36 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
> index 7e179f81d05c..7a62a2f7bc18 100644
> --- a/drivers/usb/gadget/legacy/inode.c
> +++ b/drivers/usb/gadget/legacy/inode.c
> @@ -227,7 +227,7 @@ static void put_ep (struct ep_data *data)
>   * implicitly, starting with the driver name and then endpoint names.
>   */
>  
> -static const char *CHIP;
> +static char CHIP[32];
>  
>  /*----------------------------------------------------------------------*/
>  
> @@ -1697,28 +1697,6 @@ static struct usb_gadget_driver gadgetfs_driver = {
>  };
>  
>  /*----------------------------------------------------------------------*/
> -
> -static void gadgetfs_nop(struct usb_gadget *arg) { }
> -
> -static int gadgetfs_probe(struct usb_gadget *gadget,
> -		struct usb_gadget_driver *driver)
> -{
> -	CHIP = gadget->name;
> -	return -EISNAM;
> -}
> -
> -static struct usb_gadget_driver probe_driver = {
> -	.max_speed	= USB_SPEED_HIGH,
> -	.bind		= gadgetfs_probe,
> -	.unbind		= gadgetfs_nop,
> -	.setup		= (void *)gadgetfs_nop,
> -	.disconnect	= gadgetfs_nop,
> -	.driver	= {
> -		.name		= "nop",
> -	},
> -};
> -
> -
>  /* DEVICE INITIALIZATION
>   *
>   *     fd = open ("/dev/gadget/$CHIP", O_RDWR)
> @@ -1968,10 +1946,7 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent)
>  	if (the_device)
>  		return -ESRCH;
>  
> -	/* fake probe to determine $CHIP */
> -	CHIP = NULL;
> -	usb_gadget_probe_driver(&probe_driver);
> -	if (!CHIP)
> +	if (usb_get_gadget_udc_name(CHIP, sizeof(CHIP)) != 0)
>  		return -ENODEV;
>  
>  	/* superblock */
> diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c
> index fd73a3ea07c2..4bde2e110e44 100644
> --- a/drivers/usb/gadget/udc/udc-core.c
> +++ b/drivers/usb/gadget/udc/udc-core.c
> @@ -442,6 +442,39 @@ err1:
>  EXPORT_SYMBOL_GPL(usb_add_gadget_udc_release);
>  
>  /**
> + * usb_get_gadget_udc_name - get the name of the first UDC controller
> + * @dst_name
> + * @len

gotta describe these and add a blank line after @len too.

This also seems a little too big for -rc.

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (819 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ