summaryrefslogtreecommitdiff
path: root/drivers/usb/core/usb.h
diff options
context:
space:
mode:
authorThiƩbaud Weksteen <tweek@google.com>2019-08-06 13:00:50 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-08-08 16:07:34 +0200
commit27709ae4e2fe6cf7da2ae45e718e190c5433342b (patch)
tree4573510c07b599692a0040a3dd39e36bffb90d52 /drivers/usb/core/usb.h
parentc468a8aa790e0dfe0a7f8a39db282d39c2c00b46 (diff)
usb: setup authorized_default attributes using usb_bus_notify
Currently, the authorized_default and interface_authorized_default attributes for HCD are set up after the uevent has been sent to userland. This creates a race condition where userland may fail to access this file when processing the event. Move the appending of these attributes earlier relying on the usb_bus_notify dispatcher. Signed-off-by: ThiƩbaud Weksteen <tweek@google.com> Cc: stable <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20190806110050.38918-1-tweek@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core/usb.h')
-rw-r--r--drivers/usb/core/usb.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index bd8d01f85a13..0c9fde5ad052 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -153,6 +153,11 @@ static inline int is_usb_port(const struct device *dev)
return dev->type == &usb_port_device_type;
}
+static inline int is_root_hub(struct usb_device *udev)
+{
+ return (udev->parent == NULL);
+}
+
/* Do the same for device drivers and interface drivers. */
static inline int is_usb_device_driver(struct device_driver *drv)