freebsd-dev/sys
Hans Petter Selasky 12148d4300 Fix for locking order reversal in USB audio driver, when using mmap().
Locking the second lock which causes the LOR, can be skipped because
the code updating the shared variables is always executing from the
same USB thread.

lock order reversal:
  1st 0xfffff80005cc3840 pcm7:play:dsp7.p0 (pcm play channel, sleep mutex)
@ usb_transfer.c:2342
  2nd 0xfffff80005cc3860 pcm7:record:dsp7.r0 (pcm record channel, sleep mutex)
@ uaudio.c:2317

lock order pcm record channel -> pcm play channel established at:
witness_checkorder+0x461
__mtx_lock_flags+0x98
dsp_mmap_single+0x151
vm_mmap_cdev+0x65
devfs_mmap_f+0x143
kern_mmap_req+0x594
sys_mmap+0x46
amd64_syscall+0x12e
fast_syscall_common+0xf8

lock order pcm play channel -> pcm record channel attempted at:
witness_checkorder+0xd82
__mtx_lock_flags+0x98
uaudio_chan_play_callback+0xeb
usbd_callback_wrapper+0x7ec
usb_command_wrapper+0x7e
usb_callback_proc+0x8e
usb_process+0xf3
fork_exit+0x80
fork_trampoline+0xe

Found by:	Stefan Ehmann <shoesoft@gmx.net>
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-02-14 20:32:33 +01:00
..
amd64 Revert "amd64: implement strlen in assembly" 2021-02-09 16:23:18 +01:00
arm arm32: Align arguments of sync_icache() syscall to cacheline size. 2021-02-09 12:53:09 +01:00
arm64 arm64: Add a SOC_BRCM_NS2 option 2021-02-10 21:15:50 +01:00
bsm Add aio_writev and aio_readv 2021-01-02 19:57:58 -07:00
cam cam: Properly find the sim in the assertion in xpt_pollwait(). 2021-02-11 14:06:58 -08:00
cddl arm64: Improve DDB backtrace support 2021-02-01 14:15:57 +00:00
compat epoll: Store epoll_event udata member in ext member of kevent. 2021-02-08 02:46:14 +03:00
conf Only require mac_veriexec for verified_exec 2021-02-14 09:20:41 -08:00
contrib Fix non-IPv6 build post 57785538c6. 2021-02-09 17:18:25 -08:00
crypto armv8crypto: Extract GCM state into a structure 2021-02-08 09:19:10 -05:00
ddb ddb: add ability to print user registers 2021-01-08 14:53:06 -04:00
dev Fix for locking order reversal in USB audio driver, when using mmap(). 2021-02-14 20:32:33 +01:00
dts Remove DTS files for arm boards we don't support 2021-01-27 10:02:01 +00:00
fs fusefs: set d_off during VOP_READDIR 2021-02-12 21:50:52 -07:00
gdb gdb(4): allow bulk write of registers 2020-12-23 14:37:05 -04:00
geom opencrypto: Introduce crypto_dispatch_async() 2021-02-08 09:19:19 -05:00
gnu Remove the old dts imported tree. 2021-01-15 20:09:55 +01:00
i386 Fix a typo. 2021-01-27 21:52:41 -08:00
isa
kern procstat: distinguish vm map guards in procstat vm output. 2021-02-14 03:24:58 +02:00
kgssapi opencrypto: Introduce crypto_dispatch_async() 2021-02-08 09:19:19 -05:00
libkern Restore the augmented strlen commentary 2021-02-08 19:15:21 +00:00
mips mips: fix NLM platforms breakage caused by e0a0a3ef 2021-01-31 23:56:22 -08:00
modules ZFS: fix assertions with INVARIANTS 2021-02-08 16:41:35 -07:00
net Fix ifa refcount leak during route addition. 2021-02-13 00:06:14 +00:00
net80211
netgraph netgraph/ng_bridge: Add counters for the first link, too 2021-02-10 19:05:37 +01:00
netinet tcp: improve behaviour when using TCP_NOOPT 2021-02-14 12:16:57 +01:00
netinet6 Do not reference returned ifa in in6_ifawithifp(). 2021-02-14 10:11:18 +00:00
netipsec Revert "SO_RERROR indicates that receive buffer overflows should be handled as errors." 2021-02-08 22:32:32 +00:00
netpfil pf: Slightly relax pf_rule_addr validation 2021-02-14 12:07:31 +01:00
netsmb
nfs
nfsclient
nfsserver
nlm
ofed Fix mismerge in OFED update 2021-02-04 13:58:24 -05:00
opencrypto ktls: Avoid wakeups and locking for synchronous callbacks 2021-02-08 09:19:27 -05:00
powerpc powerpc64: Fix boot on virtual-mode OF (PowerMac G5) 2021-02-07 16:13:55 -06:00
riscv riscv: add SBI system reset extension 2021-01-27 19:19:54 -04:00
rpc nfs-over-tls: handle res.gid.gid_val correctly for memory allocation 2021-01-12 13:59:52 -08:00
security Convert remaining cap_rights_init users to cap_rights_init_one 2021-01-12 13:16:10 +00:00
sys procstat: distinguish vm map guards in procstat vm output. 2021-02-14 03:24:58 +02:00
teken loader: implement framebuffer console 2021-01-02 21:41:36 +02:00
tests Enable running fib tests inside vnet jail. 2021-01-17 20:32:26 +00:00
tools syscalls.master: Add a new syscall type: RESERVED 2021-01-26 18:27:44 +00:00
ufs Fix bug 253158 - Panic: snapacct_ufs2: bad block - mksnap_ffs(8) crash 2021-02-11 21:31:16 -08:00
vm vm: Honour the "noreuse" flag to vm_page_unwire_managed() 2021-02-10 11:10:27 -05:00
x86 mca: Handle inconsistent CMCI capability reporting 2021-02-08 14:42:54 -05:00
xdr
xen xen: remove .swp file from public headers 2021-01-11 18:14:11 +01:00
Makefile