<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/sys/dev/usb/usb_dev.c, branch release/12.3.0</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=release%2F12.3.0</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=release%2F12.3.0'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2021-11-03T17:39:23Z</updated>
<entry>
<title>usb(4): Fix for use after free in combination with EVDEV_SUPPORT.</title>
<updated>2021-11-03T17:39:23Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2021-10-24T11:38:04Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=791f88fff31d8067ffbfc4f0670aff84f094549d'/>
<id>urn:sha1:791f88fff31d8067ffbfc4f0670aff84f094549d</id>
<content type='text'>
When EVDEV_SUPPORT was introduced, the USB transfers may be running
after the main FIFO is closed. In connection to this a race may appear
which can lead to use-after-free scenarios. Fix this for all FIFO
consumers by initializing and resetting the FIFO queues under the
lock used by the client. Then the client driver will see an empty
queue in all cases a race may appear.

Approved by:	re@ (gjb)
Found by:	pho@
Sponsored by:	NVIDIA Networking

(cherry picked from commit aad0c65d6b37364d8ba92ecb8c85e004398a5194)
(cherry picked from commit bb9bee1ffbb27f903bfd2c11d681d331bea727ea)
</content>
</entry>
<entry>
<title>MFC r363420:</title>
<updated>2020-07-29T14:30:42Z</updated>
<author>
<name>Mark Johnston</name>
<email>markj@FreeBSD.org</email>
</author>
<published>2020-07-29T14:30:42Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=59e0a2b84ae270c00ca27b141615e994977a293a'/>
<id>urn:sha1:59e0a2b84ae270c00ca27b141615e994977a293a</id>
<content type='text'>
usb(4): Stop checking for failures from malloc(M_WAITOK).
</content>
</entry>
<entry>
<title>Do pass removing some write-only variables from the kernel.</title>
<updated>2017-12-25T04:48:39Z</updated>
<author>
<name>Alexander Kabaev</name>
<email>kan@FreeBSD.org</email>
</author>
<published>2017-12-25T04:48:39Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=151ba7933aab5c8edc094715bffd9b97d84d2407'/>
<id>urn:sha1:151ba7933aab5c8edc094715bffd9b97d84d2407</id>
<content type='text'>
This reduces noise when kernel is compiled by newer GCC versions,
such as one used by external toolchain ports.

Reviewed by: kib, andrew(sys/arm and sys/arm64), emaste(partial), erj(partial)
Reviewed by: jhb (sys/dev/pci/* sys/kern/vfs_aio.c and sys/kern/kern_synch.c)
Differential Revision: https://reviews.freebsd.org/D10385
</content>
</entry>
<entry>
<title>sys/dev: further adoption of SPDX licensing ID tags.</title>
<updated>2017-11-27T14:52:40Z</updated>
<author>
<name>Pedro F. Giffuni</name>
<email>pfg@FreeBSD.org</email>
</author>
<published>2017-11-27T14:52:40Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=718cf2ccb9956613756ab15d7a0e28f2c8e91cab'/>
<id>urn:sha1:718cf2ccb9956613756ab15d7a0e28f2c8e91cab</id>
<content type='text'>
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
</content>
</entry>
<entry>
<title>Improve USB polling mode by not locking any mutexes, asserting any</title>
<updated>2016-09-14T12:07:34Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2016-09-14T12:07:34Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=0eb8d462321b9b88bc4dd2fe3e1aa5fc8f460bb6'/>
<id>urn:sha1:0eb8d462321b9b88bc4dd2fe3e1aa5fc8f460bb6</id>
<content type='text'>
mutexes or using any callouts when active.

Trying to lock a mutex when KDB is active or the scheduler is stopped
can result in infinite wait loops. The same goes for calling callout
related functions which in turn lock mutexes.

If the USB controller at which a USB keyboard is connected is idle
when KDB is entered, polling the USB keyboard via USB will always
succeed. Else polling may fail depending on which state the USB
subsystem and USB interrupt handler is in. This is unavoidable unless
KDB can wait for USB interrupt threads to complete before stalling the
CPU(s).

Tested by:	Bruce Evans &lt;bde@freebsd.org&gt;
MFC after:	4 weeks
</content>
</entry>
<entry>
<title>Check for signals when locking the USB enumeration thread from</title>
<updated>2016-05-25T07:48:36Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2016-05-25T07:48:36Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=10aab8b6113f60e567b723bb9128c010760a2fff'/>
<id>urn:sha1:10aab8b6113f60e567b723bb9128c010760a2fff</id>
<content type='text'>
userspace, so that USB applications can be killed if an enumeration
thread should be stuck for various reasons.

MFC after:	1 week
</content>
</entry>
<entry>
<title>dev/usb: minor spelling fixes in comments.</title>
<updated>2016-05-02T17:44:03Z</updated>
<author>
<name>Pedro F. Giffuni</name>
<email>pfg@FreeBSD.org</email>
</author>
<published>2016-05-02T17:44:03Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=207332450ebe1df184818ab11115dcd7b95a5bc5'/>
<id>urn:sha1:207332450ebe1df184818ab11115dcd7b95a5bc5</id>
<content type='text'>
No functional change.

Reviewed by:	hselasky
</content>
</entry>
<entry>
<title>Don't wait forever for USB data to be flushed.</title>
<updated>2015-06-05T06:06:07Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2015-06-05T06:06:07Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=b6630e5024b180c37f33419dd5c84ec8435d69dd'/>
<id>urn:sha1:b6630e5024b180c37f33419dd5c84ec8435d69dd</id>
<content type='text'>
MFC after:	1 week
</content>
</entry>
<entry>
<title>Resolve a special case deadlock: When two or more threads are</title>
<updated>2015-01-13T16:37:43Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2015-01-13T16:37:43Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=b78e84d1325b0d2aee4cc018e93d21c02a673572'/>
<id>urn:sha1:b78e84d1325b0d2aee4cc018e93d21c02a673572</id>
<content type='text'>
simultaneously detaching kernel drivers on the same USB device we can
get stuck in the "usb_wait_pending_ref_locked()" function because the
conditions needed for allowing detach are not met. The "destroy_dev()"
function waits for all system calls involving the given character
device to return. Character device system calls may lock the USB
enumeration lock, which is also held when "destroy_dev()" is
called. This can sometimes lead to a deadlock not noticed by
WITNESS. The current solution is to ensure the calling thread is the
only one holding the USB enumeration lock and prevent other threads
from getting refs while a USB device detach is ongoing. This turned
out not to be sufficient. To solve this deadlock we could use
"destroy_dev_sched()" to schedule the device destruction in the
background, but then we don't know when it is safe to free() the
private data of the character device. Instead a callback function is
executed by the USB explore process to kill off any leftover USB
character devices synchronously after the USB device explore code is
finished and the USB enumeration lock is no longer locked. This makes
porting easier and also ensures us that character devices must
eventually go away after a USB device detach.

While at it ensure that "flag_iserror" is only written when "priv_mtx"
is locked, which is protecting it.

MFC after:	5 days
</content>
</entry>
<entry>
<title>When we fail to get a USB reference we should just return, because</title>
<updated>2014-10-03T16:09:46Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2014-10-03T16:09:46Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=b06d477b3c860a9118ccf232d52eea8d279ab48c'/>
<id>urn:sha1:b06d477b3c860a9118ccf232d52eea8d279ab48c</id>
<content type='text'>
there are no more references held.

MFC after:	3 days
</content>
</entry>
</feed>
