kernel_samsung_a53x/drivers/usb/misc
Jeongjun Park fc10f554cd usb: using mutex lock and supporting O_NONBLOCK flag in iowarrior_read()
[ Upstream commit 44feafbaa66ec86232b123bb8437a6a262442025 ]

iowarrior_read() uses the iowarrior dev structure, but does not use any
lock on the structure. This can cause various bugs including data-races,
so it is more appropriate to use a mutex lock to safely protect the
iowarrior dev structure. When using a mutex lock, you should split the
branch to prevent blocking when the O_NONBLOCK flag is set.

In addition, it is unnecessary to check for NULL on the iowarrior dev
structure obtained by reading file->private_data. Therefore, it is
better to remove the check.

Fixes: 946b960d13c1 ("USB: add driver for iowarrior devices.")
Signed-off-by: Jeongjun Park <aha310510@gmail.com>
Link: https://lore.kernel.org/r/20240919103403.3986-1-aha310510@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-12-17 13:24:16 +01:00
..
sisusbvga
adutux.c
apple-mfi-fastcharge.c
appledisplay.c Revert "USB: appledisplay: close race between probe and completion handler" 2024-11-24 00:23:17 +01:00
chaoskey.c
cypress_cy7c63.c Revert "USB: misc: cypress_cy7c63: check for short transfer" 2024-11-24 00:23:17 +01:00
cytherm.c
ehset.c
emi26.c
emi62.c
ezusb.c
ftdi-elan.c
idmouse.c
iowarrior.c usb: using mutex lock and supporting O_NONBLOCK flag in iowarrior_read() 2024-12-17 13:24:16 +01:00
isight_firmware.c
Kconfig
ldusb.c
legousbtower.c
lvstest.c
Makefile
trancevibrator.c
usb251xb.c
usb3503.c
usb4604.c
usb_u132.h
usblcd.c
usbsevseg.c
usbtest.c
uss720.c
yurex.c Revert "usb: yurex: Replace snprintf() with the safer scnprintf() variant" 2024-11-24 00:23:14 +01:00