Skip to content

Commit

Permalink
Input: serio - take drv_mutex in serio_cleanup()
Browse files Browse the repository at this point in the history
We need to take serio->drv_mutex in serio_cleanup() to prevent the
function from being called while driver is in the middle of attaching
to a serio port. Such situation can happen with i8042 and atkbd drivers
if user rapidly presses Ctrl-Alt-Del during system startup, and leads
to kernel oops.

Reported-by: Dave Young <hidave.darkstar@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Dmitry Torokhov committed Jun 29, 2007
1 parent 9f7a60d commit 33143ea
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/input/serio/serio.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,10 @@ static int serio_driver_remove(struct device *dev)

static void serio_cleanup(struct serio *serio)
{
mutex_lock(&serio->drv_mutex);
if (serio->drv && serio->drv->cleanup)
serio->drv->cleanup(serio);
mutex_unlock(&serio->drv_mutex);
}

static void serio_shutdown(struct device *dev)
Expand Down

0 comments on commit 33143ea

Please sign in to comment.