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:   Fri, 26 Feb 2021 10:24:54 +0100
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Ricky Niu <rickyniu@...gle.com>
Cc:     stern@...land.harvard.edu, erosca@...adit-jv.com,
        gustavoars@...nel.org, a.darwish@...utronix.de, oneukum@...e.com,
        kyletso@...gle.com, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ANDROID: usb: core: Send uevent when USB TOPO layer over
 6

On Fri, Feb 26, 2021 at 05:16:12PM +0800, Ricky Niu wrote:
> When the topology of the nested hubs are over 6 layers
> Send uevent to user space when USB TOPO layer over 6.
> Let end user more understand what happened.
> 
> Signed-off-by: Ricky Niu <rickyniu@...gle.com>
> ---
>  drivers/usb/core/hub.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 7f71218cc1e5..e5e924526822 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -55,6 +55,10 @@ static DEFINE_SPINLOCK(device_state_lock);
>  static struct workqueue_struct *hub_wq;
>  static void hub_event(struct work_struct *work);
>  
> +/* struct to notify userspace of hub events */
> +static struct class *hub_class;
> +static struct device *hub_device;
> +
>  /* synchronize hub-port add/remove and peering operations */
>  DEFINE_MUTEX(usb_port_peer_mutex);
>  
> @@ -1764,6 +1768,13 @@ static bool hub_descriptor_is_sane(struct usb_host_interface *desc)
>          return true;
>  }
>  
> +static void hub_over_tier(void)
> +{
> +	char *envp[2] = { "HUB=OVERTIER", NULL };
> +
> +	kobject_uevent_env(&hub_device->kobj, KOBJ_CHANGE, envp);

Where have you now documented this odd uevent that is never sent by
anything else?

What tool will "catch" this?  Where is that code located at?

uevents are not for stuff like this, you are trying to send "error
conditions" to userspace, please use the "proper" interfaces like this
and not abuse existing ones.


> +}
> +
>  static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
>  {
>  	struct usb_host_interface *desc;
> @@ -1831,6 +1842,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
>  	if (hdev->level == MAX_TOPO_LEVEL) {
>  		dev_err(&intf->dev,
>  			"Unsupported bus topology: hub nested too deep\n");
> +		hub_over_tier();
>  		return -E2BIG;
>  	}
>  
> @@ -5680,6 +5692,13 @@ int usb_hub_init(void)
>  		return -1;
>  	}
>  
> +	hub_class = class_create(THIS_MODULE, "usb_hub");
> +	if (IS_ERR(hub_class))
> +		return PTR_ERR(hub_class);
> +
> +	hub_device =
> +		device_create(hub_class, NULL, MKDEV(0, 0), NULL, "usb_hub");

You just created a whole new sysfs class with no Documentation/ABI/
update?

{sigh}

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ