Amit Shah <[email protected]> writes:
> Port unplug can race with close() in port_fops_release().
> port_fops_release() already takes the necessary locks, ensure
> unplug_port() does that too.
>
> Signed-off-by: Amit Shah <[email protected]>

Applied,
Rusty.

> ---
>  drivers/char/virtio_console.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
> index 9cbed93..e8b707d 100644
> --- a/drivers/char/virtio_console.c
> +++ b/drivers/char/virtio_console.c
> @@ -1541,6 +1541,7 @@ static void unplug_port(struct port *port)
>       list_del(&port->list);
>       spin_unlock_irq(&port->portdev->ports_lock);
>  
> +     spin_lock_irq(&port->inbuf_lock);
>       if (port->guest_connected) {
>               /* Let the app know the port is going down. */
>               send_sigio_to_port(port);
> @@ -1551,6 +1552,7 @@ static void unplug_port(struct port *port)
>  
>               wake_up_interruptible(&port->waitqueue);
>       }
> +     spin_unlock_irq(&port->inbuf_lock);
>  
>       if (is_console_port(port)) {
>               spin_lock_irq(&pdrvdata_lock);
> -- 
> 1.8.1.4
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Reply via email to