[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH] char-socket: hold chr_write_lock during tcp
From: |
Daniel P . Berrangé |
Subject: |
Re: [Qemu-devel] [RFC PATCH] char-socket: hold chr_write_lock during tcp_chr_free_connection() |
Date: |
Wed, 6 Feb 2019 13:14:10 +0000 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Wed, Feb 06, 2019 at 01:52:59PM +0100, Paolo Bonzini wrote:
> On 06/02/19 13:49, Daniel P. Berrangé wrote:
> > On Wed, Feb 06, 2019 at 02:43:45PM +0200, Alberto Garcia wrote:
> >> There's a race condition in which the tcp_chr_read() ioc handler can
> >> close a connection that is being written to from another thread.
> > Isn't the chardev only ever supposed to be read/written from a
> > single thread.
> >
>
> No, writes from multiple threads are allowed; of course they have to
> have proper locking to avoid mixing messages.
>
> Reads have to happen from a single thread because they are tied to the
> chr_read handlers.
Ok, then we really ought to have full locking around tcp_chr_disconnect
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|