• Johan Hovold's avatar
    serdev: fix tty-port client deregistration · 84ac7693
    Johan Hovold authored
    commit aee5da78 upstream.
    
    The port client data must be set when registering the serdev controller
    or client deregistration will fail (and the serdev devices are left
    registered and allocated) if the port was never opened in between.
    
    Make sure to clear the port client data on any probe errors to avoid a
    use-after-free when the client is later deregistered unconditionally
    (e.g. in a tty-port deregistration helper).
    
    Also move port client operation initialisation to registration. Note
    that the client ops must be restored on failed probe.
    
    Fixes: bed35c6d ("serdev: add a tty port controller driver")
    Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
    Reviewed-by: default avatarRob Herring <robh@kernel.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    84ac7693
serdev-ttyport.c 5.95 KB