[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 31/81] 9pfs: fail local_statfs() earlier
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 31/81] 9pfs: fail local_statfs() earlier |
Date: |
Mon, 20 Mar 2017 18:07:55 -0500 |
From: Greg Kurz <address@hidden>
If we cannot open the given path, we can return right away instead of
passing -1 to fstatfs() and close(). This will make Coverity happy.
(Coverity issue CID1371729)
Signed-off-by: Greg Kurz <address@hidden>
Reviewed-by: Daniel P. berrange <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
(cherry picked from commit 23da0145cc4be66fdb1033f951dbbf140f457896)
Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: Michael Roth <address@hidden>
---
hw/9pfs/9p-local.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
index c5f7dcd..09b9b57 100644
--- a/hw/9pfs/9p-local.c
+++ b/hw/9pfs/9p-local.c
@@ -1054,6 +1054,9 @@ static int local_statfs(FsContext *s, V9fsPath *fs_path,
struct statfs *stbuf)
int fd, ret;
fd = local_open_nofollow(s, fs_path->data, O_RDONLY, 0);
+ if (fd == -1) {
+ return -1;
+ }
ret = fstatfs(fd, stbuf);
close_preserve_errno(fd);
return ret;
--
2.7.4
- [Qemu-stable] [PATCH 14/81] 9pfs: local: statfs: don't follow symlinks, (continued)
- [Qemu-stable] [PATCH 14/81] 9pfs: local: statfs: don't follow symlinks, Michael Roth, 2017/03/20
- [Qemu-stable] [PATCH 19/81] 9pfs: local: rename: use renameat, Michael Roth, 2017/03/20
- [Qemu-stable] [PATCH 23/81] 9pfs: local: chown: don't follow symlinks, Michael Roth, 2017/03/20
- [Qemu-stable] [PATCH 20/81] 9pfs: local: improve error handling in link op, Michael Roth, 2017/03/20
- [Qemu-stable] [PATCH 21/81] 9pfs: local: link: don't follow symlinks, Michael Roth, 2017/03/20
- [Qemu-stable] [PATCH 01/81] 9pfs: local: move xattr security ops to 9p-xattr.c, Michael Roth, 2017/03/20
- [Qemu-stable] [PATCH 25/81] 9pfs: local: mknod: don't follow symlinks, Michael Roth, 2017/03/20
- [Qemu-stable] [PATCH 22/81] 9pfs: local: chmod: don't follow symlinks, Michael Roth, 2017/03/20
- [Qemu-stable] [PATCH 27/81] 9pfs: local: open2: don't follow symlinks, Michael Roth, 2017/03/20
- [Qemu-stable] [PATCH 28/81] 9pfs: local: drop unused code, Michael Roth, 2017/03/20
- [Qemu-stable] [PATCH 31/81] 9pfs: fail local_statfs() earlier,
Michael Roth <=
- [Qemu-stable] [PATCH 02/81] 9pfs: remove side-effects in local_init(), Michael Roth, 2017/03/20
- [Qemu-stable] [PATCH 35/81] machine: Convert abstract typename on compat_props to subclass names, Michael Roth, 2017/03/20
- [Qemu-stable] [PATCH 24/81] 9pfs: local: symlink: don't follow symlinks, Michael Roth, 2017/03/20
- [Qemu-stable] [PATCH 29/81] 9pfs: fix bogus fd check in local_remove(), Michael Roth, 2017/03/20
- [Qemu-stable] [PATCH 26/81] 9pfs: local: mkdir: don't follow symlinks, Michael Roth, 2017/03/20
- [Qemu-stable] [PATCH 30/81] 9pfs: fix fd leak in local_opendir(), Michael Roth, 2017/03/20
- [Qemu-stable] [PATCH 38/81] virtio: fix vq->inuse recalc after migr, Michael Roth, 2017/03/20
- [Qemu-stable] [PATCH 03/81] 9pfs: remove side-effects in local_open() and local_opendir(), Michael Roth, 2017/03/20
- [Qemu-stable] [PATCH 46/81] exec: Add missing rcu_read_unlock, Michael Roth, 2017/03/20
- [Qemu-stable] [PATCH 50/81] tcg/aarch64: Fix addsub2 for 0+C, Michael Roth, 2017/03/20