alistair23-linux/arch/um/drivers
Johannes Berg b364824177 um: virtio: Keep reading on -EAGAIN
[ Upstream commit 7e60746005 ]

When we get an interrupt from the socket getting readable,
and start reading, there's a possibility for a race. This
depends on the implementation of the device, but e.g. with
qemu's libvhost-user, we can see:

 device                 virtio_uml
---------------------------------------
  write header
                         get interrupt
                         read header
                         read body -> returns -EAGAIN
  write body

The -EAGAIN return is because the socket is non-blocking,
and then this leads us to abandon this message.

In fact, we've already read the header, so when the get
another signal/interrupt for the body, we again read it
as though it's a new message header, and also abandon it
for the same reason (wrong size etc.)

This essentially breaks things, and if that message was
one that required a response, it leads to a deadlock as
the device is waiting for the response but we'll never
reply.

Fix this by spinning on -EAGAIN as well when we read the
message body. We need to handle -EAGAIN as "no message"
while reading the header, since we share an interrupt.

Note that this situation is highly unlikely to occur in
normal usage, since there will be very few messages and
only in the startup phase. With the inband call feature
this does tend to happen (eventually) though.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-04 19:18:24 +01:00
..
chan.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
chan_kern.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
chan_user.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
chan_user.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
cow.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cow_sys.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cow_user.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
daemon.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
daemon_kern.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
daemon_user.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
fd.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
harddog_kern.c *: convert stream-like files from nonseekable_open -> stream_open 2019-05-06 17:46:41 +03:00
harddog_user.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
hostaudio_kern.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
Kconfig um: drivers: Add virtio vhost-user driver 2019-09-15 21:37:15 +02:00
line.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
line.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
Makefile um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
mconsole.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
mconsole_kern.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
mconsole_kern.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
mconsole_user.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
mmapper_kern.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
net_kern.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
net_user.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
null.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
pcap_kern.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
pcap_user.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
pcap_user.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
port.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
port_kern.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
port_user.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
pty.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
random.c um: Remove obsolete reenable_XX calls 2018-12-27 22:48:35 +01:00
slip.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
slip_common.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
slip_common.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
slip_kern.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
slip_user.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
slirp.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
slirp_kern.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
slirp_user.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
ssl.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
stderr_console.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
stdio_console.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
stdio_console.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
tty.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
ubd.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
ubd_kern.c um-ubd: Entrust re-queue to the upper layers 2019-10-29 10:07:41 -06:00
ubd_user.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
umcast.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
umcast_kern.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
umcast_user.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
vde.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
vde_kern.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
vde_user.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
vector_kern.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
vector_kern.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
vector_transports.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
vector_user.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
vector_user.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
vhost_user.h um: virtio: Implement VHOST_USER_PROTOCOL_F_REPLY_ACK 2019-09-15 21:37:16 +02:00
virtio_uml.c um: virtio: Keep reading on -EAGAIN 2020-01-04 19:18:24 +01:00
xterm.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
xterm.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
xterm_kern.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00