فهرست منبع

Input: serio - take drv_mutex in serio_cleanup()

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>
Dmitry Torokhov 18 سال پیش
والد
کامیت
33143ea1a3
1فایلهای تغییر یافته به همراه2 افزوده شده و 0 حذف شده
  1. 2 0
      drivers/input/serio/serio.c

+ 2 - 0
drivers/input/serio/serio.c

@@ -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)