linux-stable/include
Jean-Philippe Brucker 09c90f89b2 uacce: Handle parent device removal or parent driver module rmmod
[ Upstream commit 80fc671bcc ]

The uacce driver must deal with a possible removal of the parent device
or parent driver module rmmod at any time.

Although uacce_remove(), called on device removal and on driver unbind,
prevents future use of the uacce fops by removing the cdev, fops that
were called before that point may still be running.

Serialize uacce_fops_open() and uacce_remove() with uacce->mutex.
Serialize other fops against uacce_remove() with q->mutex.
Since we need to protect uacce_fops_poll() which gets called on the fast
path, replace uacce->queues_lock with q->mutex to improve scalability.
The other fops are only used during setup.

uacce_queue_is_valid(), checked under q->mutex or uacce->mutex, denotes
whether uacce_remove() has disabled all queues. If that is the case,
don't go any further since the parent device is being removed and
uacce->ops should not be called anymore.

Reported-by: Yang Shen <shenyang39@huawei.com>
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Link: https://lore.kernel.org/r/20220701034843.7502-1-zhangfei.gao@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-08-25 11:38:14 +02:00
..
acpi ACPI: CPPC: Do not prevent CPPC from working in the future 2022-08-21 15:16:20 +02:00
asm-generic locking/atomic: Make test_and_*_bit() ordered on failure 2022-08-25 11:38:10 +02:00
clocksource
crypto crypto: drbg - make reseeding from get_random_bytes() synchronous 2022-06-06 08:42:42 +02:00
drm drm: fix EDID struct for old ARM OABI format 2022-06-09 10:20:59 +02:00
dt-bindings
keys
kunit
kvm
linux uacce: Handle parent device removal or parent driver module rmmod 2022-08-25 11:38:14 +02:00
math-emu
media
memory memory: renesas-rpc-if: Fix HF/OSPI data transfer in Manual Mode 2022-05-09 09:05:02 +02:00
misc
net net: allow unbound socket for packets in VRF when tcp_l3mdev_accept set 2022-08-21 15:15:51 +02:00
pcmcia
ras
rdma RDMA/netlink: Add __maybe_unused to static inline in C file 2021-11-26 10:39:21 +01:00
scsi scsi: fcoe: Fix Wstringop-overflow warnings in fcoe_wwn_from_mac() 2022-06-09 10:21:15 +02:00
soc firmware: raspberrypi: Keep count of all consumers 2021-09-15 09:50:41 +02:00
sound ALSA: jack: Access input_dev under mutex 2022-06-09 10:20:51 +02:00
target scsi: target: Fix ordered tag handling 2021-11-26 10:39:11 +01:00
trace tracing: Use a struct alignof to determine trace event field alignment 2022-08-21 15:16:23 +02:00
uapi PCI/ERR: Bind RCEC devices to the Root Port driver 2022-08-21 15:16:18 +02:00
vdso
video video: of_display_timing.h: include errno.h 2022-07-12 16:32:19 +02:00
xen xen/gnttab: fix gnttab_end_foreign_access() without page specified 2022-03-11 12:11:54 +01:00