• Amit Shah's avatar
    virtio: console: Add reference counting for port struct · b353a6b8
    Amit Shah authored
    When a port got hot-unplugged, when a port was open, any file operation
    after the unplugging resulted in a crash. This is fixed by ref-counting
    the port structure, and releasing it only when the file is closed.
    
    This splits the unplug operation in two parts: first marks the port
    as unavailable, removes all the buffers in the vqs and removes the port
    from the per-device list of ports. The second stage, invoked when all
    references drop to zero, releases the chardev and frees all other memory.
    Signed-off-by: default avatarAmit Shah <amit.shah@redhat.com>
    Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
    b353a6b8
virtio_console.c 42.7 KB