lkml.org 
[lkml]   [2009]   [Apr]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: serial: fixup /proc/tty/driver/serial after proc_fops conversion
From
On Wed, Apr 1, 2009 at 23:59, Linux Kernel Mailing List
<linux-kernel@vger.kernel.org> 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@gmail.com>
>    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
> ---
>  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@linux-m68k.org

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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2009-04-02 09:45    [W:0.026 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site