1
0
Fork 0
alistair23-linux/arch
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
..
alpha mm: introduce MADV_PAGEOUT 2019-09-25 17:51:41 -07:00
arc ARC: perf: Accommodate big-endian CPU 2019-10-22 09:59:43 -07:00
arm ARM: 8937/1: spectre-v2: remove Brahma-B53 from hardening 2020-01-04 19:18:12 +01:00
arm64 KVM: arm64: Ensure 'params' is initialised when looking up sys register 2019-12-31 16:46:24 +01:00
c6x mm: consolidate pgtable_cache_init() and pgd_cache_init() 2019-09-24 15:54:09 -07:00
csky csky-for-linus-5.4-rc1: arch/csky patches for 5.4-rc1 2019-09-30 10:16:17 -07:00
h8300 mm: consolidate pgtable_cache_init() and pgd_cache_init() 2019-09-24 15:54:09 -07:00
hexagon mm: treewide: clarify pgtable_page_{ctor,dtor}() naming 2019-09-26 10:10:44 -07:00
ia64 Merge branch 'akpm' (patches from Andrew) 2019-09-24 16:10:23 -07:00
m68k mm: treewide: clarify pgtable_page_{ctor,dtor}() naming 2019-09-26 10:10:44 -07:00
microblaze Merge branch 'akpm' (patches from Andrew) 2019-09-24 16:10:23 -07:00
mips Revert "MIPS: futex: Emit Loongson3 sync workarounds within asm" 2020-01-04 19:16:21 +01:00
nds32 mm: consolidate pgtable_cache_init() and pgd_cache_init() 2019-09-24 15:54:09 -07:00
nios2 nios2 update for v5.4-rc1 2019-09-27 13:02:19 -07:00
openrisc mm: treewide: clarify pgtable_page_{ctor,dtor}() naming 2019-09-26 10:10:44 -07:00
parisc parisc: fix frame pointer in ftrace_regs_caller() 2019-10-30 21:24:40 +01:00
powerpc powerpc: Don't add -mabi= flags when building with Clang 2020-01-04 19:18:23 +01:00
riscv RISC-V: Add PCIe I/O BAR memory mapping 2019-10-28 10:43:32 -07:00
s390 s390/ftrace: fix endless recursion in function_graph tracer 2019-12-31 16:46:02 +01:00
sh pinctrl: sh-pfc: sh7734: Fix duplicate TCLK1_B 2019-12-31 16:44:32 +01:00
sparc sparc64: implement ioremap_uc 2019-12-13 08:42:17 +01:00
um um: virtio: Keep reading on -EAGAIN 2020-01-04 19:18:24 +01:00
unicore32 mm: treewide: clarify pgtable_page_{ctor,dtor}() naming 2019-09-26 10:10:44 -07:00
x86 x86/mce: Fix possibly incorrect severity calculation on AMD 2019-12-31 16:46:27 +01:00
xtensa xtensa: fix syscall_set_return_value 2019-12-21 11:04:35 +01:00
.gitignore
Kconfig arm64, mm: make randomization selected by generic topdown mmap layout 2019-09-24 15:54:11 -07:00