Skip to content

Commit

Permalink
Input: replace spin_lock_bh with spin_lock_irqsave in ml_ff_playback
Browse files Browse the repository at this point in the history
ml_ff_playback() uses spin_(un)lock_bh. However this function is
called with interrupts disabled from erase_effect() in
drivers/input/ff-core.c:196.

This is not permitted, and will result in a WARN_ON in the bottom
half handling code. This patch changes this function to just use
spin_lock_irqsave() instead, solving the problem and simplifying
the locking logic.

This was reported as entry #106559 in kerneloops.org

Reported-by: kerneloops.org
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Arjan van de Ven authored and Dmitry Torokhov committed Nov 24, 2008
1 parent 5f4ba04 commit 8442c87
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/input/ff-memless.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,9 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value)
{
struct ml_device *ml = dev->ff->private;
struct ml_effect_state *state = &ml->states[effect_id];
unsigned long flags;

spin_lock_bh(&ml->timer_lock);
spin_lock_irqsave(&ml->timer_lock, flags);

if (value > 0) {
debug("initiated play");
Expand All @@ -424,7 +425,7 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value)
ml_play_effects(ml);
}

spin_unlock_bh(&ml->timer_lock);
spin_unlock_irqrestore(&ml->timer_lock, flags);

return 0;
}
Expand Down

0 comments on commit 8442c87

Please sign in to comment.