• Luiz Fernando Capitulino's avatar
    [PATCH] USB: usbserial: race-condition fix. · 8a4613f0
    Luiz Fernando Capitulino authored
    There is a race-condition in usb-serial driver that can be triggered if
    a processes does 'port->tty->driver_data = NULL' in serial_close() while
    other processes is in kernel-space about to call serial_ioctl() on the
    same port.
    
    This happens because a process can open the device while there is
    another one closing it.
    
    The patch below fixes that by adding a semaphore to ensure that no
    process will open the device while another process is closing it.
    
    Note that we can't use spinlocks here, since serial_open() and
    serial_close() can sleep.
    Signed-off-by: default avatarLuiz Capitulino <lcapitulino@mandriva.com.br>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    8a4613f0
usb-serial.c 31.3 KB