Re: [PATCH] vt: avoid BUG_ON in con_shutdown when con_open returnswith error
From: Alan Cox
Date: Thu Mar 31 2011 - 06:16:56 EST
O
> +static inline void con_ops_set_shutdown(void);
> static int con_open(struct tty_struct *, struct file *);
> static void vc_init(struct vc_data *vc, unsigned int rows,
> unsigned int cols, int do_clear);
> @@ -2806,6 +2807,14 @@ static int con_open(struct tty_struct *tty,
> struct file *filp) tty->driver_data = vc;
> vc->port.tty = tty;
>
> + /* We must set shutdown only here, otherwise
> + * we returned from con_open with error,
> which
> + * will make tty core call tty_release, that
> + * in its call path makes con_shutdown being
> + * called without tty->driver_data being set,
> + * triggering the BUG_ON there */
> + con_ops_set_shutdown();
No we cannot go around patching the tty_operations - they are not
locked for one.
Probably this is one case where making con_shutdown() check is the
right answer.
--
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/