OSDN Git Service

um: virtio: fix handling of messages without payload
authorJohannes Berg <johannes.berg@intel.com>
Tue, 15 Dec 2020 09:52:22 +0000 (10:52 +0100)
committerRichard Weinberger <richard@nod.at>
Fri, 12 Feb 2021 20:21:52 +0000 (21:21 +0100)
If we have a message without payload, we call full_read() with
len set to 0, which causes it to return -ECONNRESET. Catch this
case and explicitly return 0 for it so we can actually use the
zero-size config-changed message.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
arch/um/drivers/virtio_uml.c

index 515d648..ef620ca 100644 (file)
@@ -97,6 +97,9 @@ static int full_read(int fd, void *buf, int len, bool abortable)
 {
        int rc;
 
+       if (!len)
+               return 0;
+
        do {
                rc = os_read_file(fd, buf, len);
                if (rc > 0) {