lkml.org 
[lkml]   [2008]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch 03/37] serial: access after NULL check in uart_flush_buffer()
    2.6.25-stable review patch.  If anyone has any objections, please let us
    know.

    ------------------
    From: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>

    commit 55d7b68996a5064f011d681bca412b6281d2f711 upstream

    I noticed that

    static void uart_flush_buffer(struct tty_struct *tty)
    {
    struct uart_state *state = tty->driver_data;
    struct uart_port *port = state->port;
    unsigned long flags;

    /*
    * This means you called this function _after_ the port was
    * closed. No cookie for you.
    */
    if (!state || !state->info) {
    WARN_ON(1);
    return;
    }

    is too late for checking state != NULL.

    Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

    ---
    drivers/serial/serial_core.c | 3 ++-
    1 file changed, 2 insertions(+), 1 deletion(-)

    --- a/drivers/serial/serial_core.c
    +++ b/drivers/serial/serial_core.c
    @@ -535,7 +535,7 @@ static int uart_chars_in_buffer(struct t
    static void uart_flush_buffer(struct tty_struct *tty)
    {
    struct uart_state *state = tty->driver_data;
    - struct uart_port *port = state->port;
    + struct uart_port *port;
    unsigned long flags;

    /*
    @@ -547,6 +547,7 @@ static void uart_flush_buffer(struct tty
    return;
    }

    + port = state->port;
    pr_debug("uart_flush_buffer(%d) called\n", tty->index);

    spin_lock_irqsave(&port->lock, flags);
    --


    \
     
     \ /
      Last update: 2008-05-13 22:15    [W:0.022 / U:0.484 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site