ddf19c
From 901c005299b0316bbca7bc190de56f6c7a2a9880 Mon Sep 17 00:00:00 2001
ddf19c
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
ddf19c
Date: Tue, 3 Mar 2020 18:43:11 +0000
ddf19c
Subject: [PATCH 15/18] virtiofsd: do_read missing NULL check
ddf19c
MIME-Version: 1.0
ddf19c
Content-Type: text/plain; charset=UTF-8
ddf19c
Content-Transfer-Encoding: 8bit
ddf19c
ddf19c
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
ddf19c
Message-id: <20200303184314.155564-5-dgilbert@redhat.com>
ddf19c
Patchwork-id: 94127
ddf19c
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 4/7] virtiofsd: do_read missing NULL check
ddf19c
Bugzilla: 1797064
ddf19c
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
ddf19c
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
ddf19c
RH-Acked-by: Ján Tomko <jtomko@redhat.com>
ddf19c
ddf19c
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
ddf19c
ddf19c
Missing a NULL check if the argument fetch fails.
ddf19c
ddf19c
Fixes: Coverity CID 1413119
ddf19c
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
ddf19c
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
ddf19c
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
ddf19c
(cherry picked from commit 99ce9a7e60fd12b213b985343ff8fcc172de59fd)
ddf19c
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ddf19c
---
ddf19c
 tools/virtiofsd/fuse_lowlevel.c | 4 ++++
ddf19c
 1 file changed, 4 insertions(+)
ddf19c
ddf19c
diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowlevel.c
ddf19c
index 01c418a..704c036 100644
ddf19c
--- a/tools/virtiofsd/fuse_lowlevel.c
ddf19c
+++ b/tools/virtiofsd/fuse_lowlevel.c
ddf19c
@@ -1116,6 +1116,10 @@ static void do_read(fuse_req_t req, fuse_ino_t nodeid,
ddf19c
         struct fuse_file_info fi;
ddf19c
 
ddf19c
         arg = fuse_mbuf_iter_advance(iter, sizeof(*arg));
ddf19c
+        if (!arg) {
ddf19c
+            fuse_reply_err(req, EINVAL);
ddf19c
+            return;
ddf19c
+        }
ddf19c
 
ddf19c
         memset(&fi, 0, sizeof(fi));
ddf19c
         fi.fh = arg->fh;
ddf19c
-- 
ddf19c
1.8.3.1
ddf19c