diff options
author | Jeongjun Park <aha310510@gmail.com> | 2024-09-19 19:34:03 +0900 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-10-04 15:16:04 +0200 |
commit | 44feafbaa66ec86232b123bb8437a6a262442025 (patch) | |
tree | f035c5f78ceaa58fdbeecc5c8a8a8724e5cfa7f6 /drivers/gpu/drm/amd/amdgpu/atom.c | |
parent | 67c6150c0c5faeaaf5cf5c1b1cc6501d431d58d1 (diff) |
usb: using mutex lock and supporting O_NONBLOCK flag in iowarrior_read()
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>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/atom.c')
0 files changed, 0 insertions, 0 deletions