aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
authorGabriel Krisman Bertazi <krisman@collabora.com>2020-03-16 20:45:07 -0400
committerRichard Weinberger <richard@nod.at>2020-03-29 23:21:37 +0200
commite355b2f55efc4633409ada14125c9e28ad2de012 (patch)
tree445a3507b25758f740ce9cd9a02deab24ce01755 /arch/um
parentum: ubd: Prevent buffer overrun on command completion (diff)
downloadlinux-dev-e355b2f55efc4633409ada14125c9e28ad2de012.tar.xz
linux-dev-e355b2f55efc4633409ada14125c9e28ad2de012.zip
um: ubd: Retry buffer read on any kind of error
Should bulk_req_safe_read return an error, we want to retry the read, otherwise, even though no IO will be done, os_write_file might still end up writing garbage to the pipe. Cc: Martyn Welch <martyn.welch@collabora.com> Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/drivers/ubd_kern.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index eca45ad2166c..eae8c83364f7 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -1592,11 +1592,11 @@ int io_thread(void *arg)
&io_remainder_size,
UBD_REQ_BUFFER_SIZE
);
- if (n < 0) {
- if (n == -EAGAIN) {
+ if (n <= 0) {
+ if (n == -EAGAIN)
ubd_read_poll(-1);
- continue;
- }
+
+ continue;
}
for (count = 0; count < n/sizeof(struct io_thread_req *); count++) {