• Amit Shah's avatar
    virtio: console: return -ENODEV on all read operations after unplug · 96f97a83
    Amit Shah authored
    If a port gets unplugged while a user is blocked on read(), -ENODEV is
    returned.  However, subsequent read()s returned 0, indicating there's no
    host-side connection (but not indicating the device went away).
    
    This also happened when a port was unplugged and the user didn't have
    any blocking operation pending.  If the user didn't monitor the SIGIO
    signal, they won't have a chance to find out if the port went away.
    
    Fix by returning -ENODEV on all read()s after the port gets unplugged.
    write() already behaves this way.
    
    CC: <stable@vger.kernel.org>
    Signed-off-by: default avatarAmit Shah <amit.shah@redhat.com>
    Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
    96f97a83
virtio_console.c 54.9 KB