Regarding the bug in FreeBSD kernel driver(s)
John Baldwin
jhb at FreeBSD.org
Wed Aug 14 15:47:29 UTC 2019
On 8/13/19 1:14 PM, Hans Petter Selasky wrote:
> On 2019-08-13 22:08, Ian Lepore wrote:
>> So once a device is attached the first time, its usb ivars are wiped
>> out. That code was surely written in a time before the devctl stuff
>> was added to allow disabling/enabling a device on the fly. I'm not
>> sure whether it will be easy to keep the ivar data around, but if so, I
>> think that would be the right fix.
>>
>> The NULL pointer checks in the patches will prevent a kernel panic, but
>> don't really make devctl enable work properly. Speaking of devctl, you
>> don't need a program to test this, you can do it from the command line:
>>
>> devctl disable uhub2
>> devctl enable uhub2
>> <panic happens here>
>
> Hi,
>
> USB drivers are not supposed to be managed outside the USB enumeration
> thread. Using devctl on USB driver is not supported. Only usbconfig is
> allowed to attach/detach USB devices.
>
> Should we perhaps teach devctl to not touch USB devices?
I think fixing USB to not break by preserving ivars is probably a better
long-term solution. ivars are not supposed to be freed and rebuilt but
should exist for the lifetime of a device_t.
--
John Baldwin
More information about the freebsd-arch
mailing list