• Jason Wessel's avatar
    USB: console: fix kernel crash on stty -a < /dev/ttyUSB0 · a9a2c8a4
    Jason Wessel authored
    * Boot with the kernel argument console=ttyUSB0,9600
    * Run: stty -a < /dev/ttyUSB0
    * Immediately you get an oops warning, which later leads to a hard
      kernel crash
    
    The commit 335f8514 created the
    original regression and commit
    6e406121 only fixed part of the
    problem.
    
    Only protect the serial->type->open() from getting executed when the
    device is used as a console.
    
    The wider scope of the console protection added in
    6e406121 causes the logic in
    serial_open() to fall through and zero out the port->port.count with
    the stty sys call.  Once the port.count is zeroed the HW will get
    closed while other drivers still have call backs to a non-initialized
    device which crashes the kernel.
    Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
    Cc: Alan Stern <stern@rowland.harvard.edu>
    Cc: stable <stable@kernel.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    a9a2c8a4
usb-serial.c 38.1 KB