[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 1/6] 9pfs: fix bogus fd check in local_remove()
From: |
Greg Kurz |
Subject: |
[Qemu-devel] [PULL 1/6] 9pfs: fix bogus fd check in local_remove() |
Date: |
Mon, 6 Mar 2017 18:54:05 +0100 |
This was spotted by Coverity as a fd leak. This is certainly true, but also
local_remove() would always return without doing anything, unless the fd is
zero, which is very unlikely.
(Coverity issue CID1371732)
Signed-off-by: Greg Kurz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
hw/9pfs/9p-local.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
index f22a3c3654db..5db7104334d6 100644
--- a/hw/9pfs/9p-local.c
+++ b/hw/9pfs/9p-local.c
@@ -1008,7 +1008,7 @@ static int local_remove(FsContext *ctx, const char *path)
int err = -1;
dirfd = local_opendir_nofollow(ctx, dirpath);
- if (dirfd) {
+ if (dirfd == -1) {
goto out;
}
--
2.7.4
- [Qemu-devel] [PULL 0/6] 9pfs fixes for 2.9 2017-03-06, Greg Kurz, 2017/03/06
- [Qemu-devel] [PULL 1/6] 9pfs: fix bogus fd check in local_remove(),
Greg Kurz <=
- [Qemu-devel] [PULL 2/6] 9pfs: fix fd leak in local_opendir(), Greg Kurz, 2017/03/06
- [Qemu-devel] [PULL 3/6] 9pfs: fail local_statfs() earlier, Greg Kurz, 2017/03/06
- [Qemu-devel] [PULL 5/6] 9pfs: fix O_PATH build break with older glibc versions, Greg Kurz, 2017/03/06
- [Qemu-devel] [PULL 4/6] 9pfs: don't use AT_EMPTY_PATH in local_set_cred_passthrough(), Greg Kurz, 2017/03/06
- [Qemu-devel] [PULL 6/6] 9pfs: fix vulnerability in openat_dir() and local_unlinkat_common(), Greg Kurz, 2017/03/06
- Re: [Qemu-devel] [PULL 0/6] 9pfs fixes for 2.9 2017-03-06, Mark Cave-Ayland, 2017/03/06
- Re: [Qemu-devel] [PULL 0/6] 9pfs fixes for 2.9 2017-03-06, Peter Maydell, 2017/03/07