diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2019-02-17 15:02:23 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2019-02-17 15:02:23 +0000 |
commit | 68e6be85dd75e11d88bed38b4a98ffd16b7b287c (patch) | |
tree | a4803be009b5d5395abb851f0a70fd7e6aae0f5c /sys/dev | |
parent | 89e9cd66898b5a00c6d988a8323c149962acc66d (diff) |
Publish new attached device once it is fully initialized.
Should prevent a race seen by florian@ where userland emits an
USB_DEVICEINFO ioctl(2) for a device whose product/vendor names
haven't yet been filled.
ok florian@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/usb/usb_subr.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index 064326e6b81..9d834f7e731 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_subr.c,v 1.147 2019/01/22 14:25:56 mpi Exp $ */ +/* $OpenBSD: usb_subr.c,v 1.148 2019/02/17 15:02:22 mpi Exp $ */ /* $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -1208,7 +1208,6 @@ usbd_new_device(struct device *parent, struct usbd_bus *bus, int depth, * address does not correspond to the hardware one. */ dev->address = addr; - bus->devices[addr] = dev; err = usbd_reload_device_desc(dev); if (err) { @@ -1245,6 +1244,8 @@ usbd_new_device(struct device *parent, struct usbd_bus *bus, int depth, return (err); } + bus->devices[addr] = dev; + err = usbd_probe_and_attach(parent, dev, port, addr); if (err) { usb_free_device(dev); |