[PATCH] serial moxa: fix wrong BUG

From: Kirill Smelkov (kirr_at_mns.spb.ru)
Date: 10/31/05

  • Next message: Kirill Smelkov: "[PATCH] serial moxa: fix leaks of struct tty_driver"
    Date:	Mon, 31 Oct 2005 13:21:32 +0300
    To: Andrew Morton <akpm@osdl.org>
    
    

    There is a wrong BUG in mxser_close.

    The BUG is triggered when tty->driver_data == NULL,
    But in fact this is not a bug, because tty->driver->close is called
    even when tty->driver->open fails.

    LDD3 tells us to do nothing in such cases.

    Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>

    Index: linux-2.6.14/drivers/char/mxser.c
    ===================================================================
    --- linux-2.6.14.orig/drivers/char/mxser.c 2005-10-31 10:57:16.000000000 +0300
    +++ linux-2.6.14/drivers/char/mxser.c 2005-10-31 11:24:58.000000000 +0300
    @@ -917,6 +917,9 @@
             struct mxser_struct *info;
             int retval, line;
     
    + /* initialize driver_data in case something fails */
    + tty->driver_data = NULL;
    +
             line = tty->index;
             if (line == MXSER_PORTS)
                     return 0;
    @@ -979,7 +982,7 @@
             if (tty->index == MXSER_PORTS)
                     return;
             if (!info)
    - BUG();
    + return;
     
             spin_lock_irqsave(&info->slock, flags);
     

    -
    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/


  • Next message: Kirill Smelkov: "[PATCH] serial moxa: fix leaks of struct tty_driver"

    Relevant Pages

    • [PATCH] __cfq_get_queue() fix for 2.6.12-rc5
      ... fails in cfq I/O scheduler. ... If it's a bug, please consider to apply the patch for 2.6.12-rc5 below. ... fails) if no __GFP_WAIT flag. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [PATCH] kernel/fork.c: VM accounting bugfix (2.6.11-rc3-bk5)
      ... that we never accounted (if security_vm_enough_memory() fails, ... If it is in fact a bug, a simple but largely untested patch (against ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] Dont explode on swsusp failure to find swap
      ... Quick look did not reveal where the bug comes ... More specifically, arch suspend calls swsusp_save. ... It fails and returns the error to the arch asm code, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • struct device::release issue
      ... if device_add fails then the release ... Is this a bug or a feature? ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Weekly Python Patch/Bug Summary
      ... Patch / Bug Summary ... new exit and quit objects ... Python memory allocator: Free memory ... tkinter Dialog fails when more than four buttons are used ...
      (comp.lang.python)