Re: [PATCH] fix dangerous pointer derefs and remove pointless casts in MOXA driver

From: Jesper Juhl
Date: Mon May 15 2006 - 05:52:36 EST


On 14/05/06, Alexey Dobriyan <adobriyan@xxxxxxxxx> wrote:
On Sun, May 14, 2006 at 03:49:35AM +0200, Jesper Juhl wrote:
> If mxser_write() gets called with a NULL 'tty' pointer, then the initial
> assignment of tty->driver_data to info will explode.

->write() is called via

tty->driver->write(tty, ...);

See? tty was already dereferenced.


Yeah, you are right.



> --- linux-2.6.17-rc4-git2-orig/drivers/char/mxser.c
> +++ linux-2.6.17-rc4-git2/drivers/char/mxser.c
> @@ -877,7 +877,7 @@ static int mxser_init(void)
>
> static void mxser_do_softint(void *private_)
> {
> - struct mxser_struct *info = (struct mxser_struct *) private_;
> + struct mxser_struct *info = private_;

Please, don't make unrelated changes, ever.

Sorry about that.
I know that's the general rule, but I guess I've been spoiled by
having some of my recent patches merged that did a few trivial things
all in one patch and people didn't seem to mind. I'll try to get out
of that habbit again.


--
Jesper Juhl <jesper.juhl@xxxxxxxxx>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
-
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/