Re: [PATCH] input: fix locking context in ml_ff_set_gain

From: Dmitry Torokhov
Date: Mon Nov 02 2009 - 01:38:34 EST


Hi Arjan,

On Sat, Oct 31, 2009 at 02:19:25PM -0700, Arjan van de Ven wrote:
> From 177c4e7a84c40925605d485f6d5367deb44a84c8 Mon Sep 17 00:00:00 2001
> From: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>
> Date: Sat, 31 Oct 2009 14:13:40 -0700
> Subject: [PATCH] input: fix locking context in ml_ff_set_gain
>
> the ml_ff_set_gain() function uses spin_lock_bh/spin_unlock_bh
> for locking. Unfortunately, this function can be called with irqs
> off:
> vfs_write ->
> evdev_write ->
> input_inject_event (disables interrupts) ->
> input_handle_event ->
> input_ff_event ->
> ml_ff_set_gain
>
> and doing spin_unlock_bh() with interrupts off is not allowed
> (and causes a nice warning as a result).
>
> This patch fixes this by turning the locking into the _irqsave variant.

Thank you for the patch but it seems that the rest of the locking in
ff-memless.c is screwqed up ever since locking (dev->event_lock) was
added to the input core and this change plugs one hole but exposes
others. I think I need to convert ff-memless.c over to rely on
event_lock instead of the private timer_lock, but I will need a couple
of days.

--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/