• Geert Uytterhoeven's avatar
    serial: sh-sci: Fix race condition between RX worker and cleanup · 04928b79
    Geert Uytterhoeven authored
    During serial port shutdown, the DMA receive worker function may still
    be called after the receive DMA cleanup function has been called.
    Fix this race condition between work_fn_rx() and sci_rx_dma_release() by
    acquiring the port's spinlock in sci_rx_dma_release().
    This requires releasing the spinlock in work_fn_rx() before calling (any
    function that may call) sci_rx_dma_release().
    
    Terminate all active receive DMA descriptors to release them, and to
    make sure no more completions come in.
    
    Do the same in sci_tx_dma_release() for symmetry, although the serial
    upper layer will no longer submit more data at this point of time.
    Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    04928b79
sh-sci.c 65.1 KB