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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 3 Dec 2018 10:19:47 +0000
From:   Pawel Laszczak <pawell@...ence.com>
To:     Roger Quadros <rogerq@...com>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>
CC:     "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Alan Douglas <adouglas@...ence.com>,
        "jbergsagel@...com" <jbergsagel@...com>,
        "nsekhar@...com" <nsekhar@...com>, "nm@...com" <nm@...com>,
        Suresh Punnoose <sureshp@...ence.com>,
        "peter.chen@....com" <peter.chen@....com>,
        Pawel Jez <pjez@...ence.com>,
        Rahul Kumar <kurahul@...ence.com>,
        Felipe Balbi <balbi@...nel.org>
Subject: RE: [RFC PATCH v2 08/15] usb:cdns3: Implements device operations part
 of the API

Hi
>>> +
>>> +static struct usb_ep *cdns3_gadget_match_ep(struct usb_gadget *gadget,
>>> +					    struct usb_endpoint_descriptor *desc,
>>> +					    struct usb_ss_ep_comp_descriptor *comp_desc)
>>> +{
>>> +	struct cdns3_device *priv_dev = gadget_to_cdns3_device(gadget);
>>> +	struct cdns3_endpoint *priv_ep;
>>> +	unsigned long flags;
>>> +
>>> +	priv_ep = cdns3_find_available_ss_ep(priv_dev, desc);
>>> +	if (IS_ERR(priv_ep)) {
>>> +		dev_err(&priv_dev->dev, "no available ep\n");
>>> +		return NULL;
>>> +	}
>>> +
>>> +	dev_dbg(&priv_dev->dev, "match endpoint: %s\n", priv_ep->name);
>>> +
>>> +	spin_lock_irqsave(&priv_dev->lock, flags);
>>> +	priv_ep->endpoint.desc = desc;
>>> +	priv_ep->dir  = usb_endpoint_dir_in(desc) ? USB_DIR_IN : USB_DIR_OUT;
>>> +	priv_ep->type = usb_endpoint_type(desc);
>>> +
>>> +	list_add_tail(&priv_ep->ep_match_pending_list,
>>> +		      &priv_dev->ep_match_list);
>>> +	spin_unlock_irqrestore(&priv_dev->lock, flags);
>>> +	return &priv_ep->endpoint;
>>> +}
>>
>>Why do you need a custom match_ep?
>>doesn't usb_ep_autoconfig suffice?
>
>I need to test it but at first glance it  looks like usb_ep_autoconfig suffice.
>
>>
>>You can check if EP is claimed or not by checking the ep->claimed flag.
>>
I checked it and did not work correct. The flag claimed is set in usb_ep_autoconf, but 
a little bit later during USB RESET this flag is cleared. 
So, I can't base on this flag.  I think that it's incorrect behavior in gadget core driver or in function drivers.
Maybe we should have additional flag in usb_ep object used during resetting, or usb_ep_autoconf function should be called after each USB RESET. 

I notice that I can based on ep->address it is set also in usb_ep_autoconf and probably is not cleared anywhere.
It's little tricky, but It looks like it works correct. I add some comment for this checking. 
Maybe in feature I will be able to replace it with claimed flag.

Felipe what's your opinion about claimed flag.  It's should be fixed or not ?

Cheers
Pawel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ