• T
    serial: 8250: fix potential deadlock in rs485-mode · b86f86e8
    Tomas Melin 提交于
    Canceling hrtimer when holding uart spinlock can deadlock.
    
    CPU0: syscall write
              -> get uart port spinlock
                  -> write uart
                      -> start_tx_rs485
                          -> hrtimer_cancel
                              -> wait for hrtimer callback to finish
    
    CPU1: hrtimer IRQ
              -> run hrtimer
                  -> em485_handle_stop_tx
                      -> get uart port spinlock
    
    CPU0 is waiting for the hrtimer callback to finish, but the hrtimer
    callback running on CPU1 is waiting to get the uart port spinlock.
    
    This deadlock can be avoided by not canceling the hrtimers in these paths.
    Setting active_timer=NULL can be done without accessing hrtimer,
    and that will effectively cancel operations that would otherwise have been
    performed by the hrtimer callback.
    Signed-off-by: NTomas Melin <tomas.melin@vaisala.com>
    Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    b86f86e8
8250_port.c 82.8 KB