2.5: console close race fix
PATCH 1/1 2.5: console close race fix
Linus,
There is a race between con_flush_chars and con_close. I first discovered it with the preemptive kernel patch, but it is a general SMP race. The idea for the fix is originally by Andrew Morton.
This fix is in 2.4. Please, apply.
Robert Love
drivers/char/console.c +6 -2
@@ -2349,14 +2349,18 @@static void con_flush_chars (struct tty_struct *tty) { -struct vt_struct *vt = (struct vt_struct *)tty->driver_data; +struct vt_struct *vt;if (in_interrupt ())/* from flush_to_ldisc */ return ;pm_access (pm_con); + +/* if we race with con_close(), vt may be null */ acquire_console_sem (); -set_cursor (vt->vc_num); + vt = (struct vt_struct *)tty->driver_data; +if (vt) +set_cursor (vt->vc_num);release_console_sem (); }