1
linux/drivers/media/IR
Jarod Wilson 69c271f33b V4L/DVB: IR/lirc_dev: fix locking in lirc_dev_fop_read
On Wed, Jul 07, 2010 at 02:52:58PM +0200, Jiri Slaby wrote:
> Hi,
>
> stanse found a locking error in lirc_dev_fop_read:
> if (mutex_lock_interruptible(&ir->irctl_lock))
>   return -ERESTARTSYS;
> ...
> while (written < length && ret == 0) {
>   if (mutex_lock_interruptible(&ir->irctl_lock)) {    #1
>     ret = -ERESTARTSYS;
>     break;
>   }
>   ...
> }
>
> remove_wait_queue(&ir->buf->wait_poll, &wait);
> set_current_state(TASK_RUNNING);
> mutex_unlock(&ir->irctl_lock);                        #2
>
> If lock at #1 fails, it beaks out of the loop, with the lock unlocked,
> but there is another "unlock" at #2.

This should do the trick. Completely untested beyond compiling, but its
not exactly a complicated fix, and in practice, I'm not aware of anyone
ever actually tripping that locking bug, so there's zero functional change
in typical use here.

Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02 15:36:23 -03:00
..
keymaps V4L/DVB: IR: add empty lirc pseudo-keymap 2010-08-02 15:18:02 -03:00
imon.c V4L/DVB: IR/imon: auto-configure another 0xffdc device variant 2010-08-02 15:33:00 -03:00
ir-core-priv.h V4L/DVB: IR: add ir-core to lirc userspace decoder bridge driver 2010-08-02 15:16:20 -03:00
ir-functions.c V4L/DVB: ir-core: move subsystem internal calls to ir-core-priv.h 2010-05-19 12:57:04 -03:00
ir-jvc-decoder.c V4L/DVB: ir-core: move decoding state to ir_raw_event_ctrl 2010-08-02 14:55:15 -03:00
ir-keytable.c V4L/DVB: Bug fix: make IR work again for dm1105 2010-06-01 01:24:20 -03:00
ir-lirc-codec.c V4L/DVB: IR: add ir-core to lirc userspace decoder bridge driver 2010-08-02 15:16:20 -03:00
ir-nec-decoder.c V4L/DVB: ir-core: move decoding state to ir_raw_event_ctrl 2010-08-02 14:55:15 -03:00
ir-raw-event.c V4L/DVB: IR: add ir-core to lirc userspace decoder bridge driver 2010-08-02 15:16:20 -03:00
ir-rc5-decoder.c V4L/DVB: ir-core: move decoding state to ir_raw_event_ctrl 2010-08-02 14:55:15 -03:00
ir-rc6-decoder.c V4L/DVB: ir-core: move decoding state to ir_raw_event_ctrl 2010-08-02 14:55:15 -03:00
ir-sony-decoder.c V4L/DVB: ir-core: move decoding state to ir_raw_event_ctrl 2010-08-02 14:55:15 -03:00
ir-sysfs.c V4L/DVB: IR: add ir-core to lirc userspace decoder bridge driver 2010-08-02 15:16:20 -03:00
Kconfig V4L/DVB: IR: add ir-core to lirc userspace decoder bridge driver 2010-08-02 15:16:20 -03:00
lirc_dev.c V4L/DVB: IR/lirc_dev: fix locking in lirc_dev_fop_read 2010-08-02 15:36:23 -03:00
lirc_dev.h V4L/DVB: IR: add lirc device interface 2010-08-02 15:04:19 -03:00
Makefile V4L/DVB: IR: add ir-core to lirc userspace decoder bridge driver 2010-08-02 15:16:20 -03:00
mceusb.c V4L/DVB: IR/mceusb: unify and simplify different gen device init 2010-08-02 15:34:49 -03:00
rc-map.c V4L/DVB: media/IR: Add missing include file to rc-map.c 2010-05-19 12:59:12 -03:00