cryptospore / rpms / qemu-kvm

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