• Johan Hovold's avatar
    serdev: fix receive_buf return value when no callback · fd00cf81
    Johan Hovold authored
    The receive_buf callback is supposed to return the number of bytes
    processed and should specifically not return a negative errno.
    
    Due to missing sanity checks in the serdev tty-port controller, a driver
    not providing a receive_buf callback could cause the flush_to_ldisc()
    worker to spin in a tight loop when the tty buffer pointers are
    incremented with -EINVAL (-22).
    
    The missing sanity checks have now been added to the tty-port
    controller, but let's fix up the serdev-controller helper as well.
    Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    fd00cf81
serdev.h 9.48 KB