Re: serial: fixup /proc/tty/driver/serial after proc_fops conversion

From: Geert Uytterhoeven
Date: Thu Apr 02 2009 - 03:43:29 EST


On Wed, Apr 1, 2009 at 23:59, Linux Kernel Mailing List
<linux-kernel@xxxxxxxxxxxxxxx> wrote:
> Â Âserial: fixup /proc/tty/driver/serial after proc_fops conversion
>
> Â Â"struct tty_driver *" lies in m->private not in v which is
> Â ÂSEQ_TOKEN_START which is 1 which is enough to trigger NULL dereference
> Â Ânext line:
>
> Â Â Â ÂBUG: unable to handle kernel NULL pointer dereference at 000000ad
> Â Â Â ÂIP: [<c040d689>] uart_proc_show+0xe/0x2b0
>
> Â ÂNoticed by Linus.
>
> Â ÂSigned-off-by: Alexey Dobriyan <adobriyan@xxxxxxxxx>
> Â ÂSigned-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
> ---
> Âdrivers/serial/serial_core.c | Â Â2 +-
> Â1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
> index bf3c0e3..b0bb29d 100644
> --- a/drivers/serial/serial_core.c
> +++ b/drivers/serial/serial_core.c
> @@ -1765,7 +1765,7 @@ static void uart_line_info(struct seq_file *m, struct uart_driver *drv, int i)
>
> Âstatic int uart_proc_show(struct seq_file *m, void *v)
> Â{
> - Â Â Â struct tty_driver *ttydrv = v;
> + Â Â Â struct tty_driver *ttydrv = m->private;
> Â Â Â Âstruct uart_driver *drv = ttydrv->driver_state;
> Â Â Â Âint i;

Yeah, I've been bitten by this one in the past, too. It's very
confusing to have a `void *'
parameter in a callback whose registration (proc_create_data()) also
takes a `void *'.

What is this `v' parameter actually used for? I couldn't find any
users during a quick
(non-exhaustive) search?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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/