]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
media: imon: grab lock earlier in imon_ir_change_protocol()
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Thu, 17 Jul 2025 16:04:00 +0000 (01:04 +0900)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Fri, 15 Aug 2025 07:47:13 +0000 (09:47 +0200)
commit7019553ab850ce1d3f0e512e16d14ab153f91c04
tree38bf14c056f7a510a01edb9e45ba3b0a7f419b5e
parenteecd203ada43a4693ce6fdd3a58ae10c7819252c
media: imon: grab lock earlier in imon_ir_change_protocol()

Move mutex_trylock() in imon_ir_change_protocol() to the beginning,
for memcpy() which modifies ictx->usb_tx_buf should be protected by
ictx->lock.

Also, verify at the beginning of send_packet() that ictx->lock is held
in case send_packet() is by error called from imon_ir_change_protocol()
when mutex_trylock() failed due to concurrent requests.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/rc/imon.c