Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Aug 2019 08:47:27 -0700
From:      John Baldwin <jhb@FreeBSD.org>
To:        Hans Petter Selasky <hps@selasky.org>, Ian Lepore <ian@freebsd.org>, Neeraj Pal <neerajpal09@gmail.com>, freebsd-arch@freebsd.org
Subject:   Re: Regarding the bug in FreeBSD kernel driver(s)
Message-ID:  <3c8e80d0-d5c8-8e13-bdd4-50f509416550@FreeBSD.org>
In-Reply-To: <52d24915-d295-806d-55c6-f801ef340c7f@selasky.org>
References:  <CANi4_RUcNt8Z0Gw1DqoOCAYt61kfhv2aoz1v9snrB_Jg38z_zQ@mail.gmail.com> <cb4108b6e8494259e31d1ab7d5163ae77a2a2116.camel@freebsd.org> <52d24915-d295-806d-55c6-f801ef340c7f@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3c8e80d0-d5c8-8e13-bdd4-50f509416550>