aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mount_bsd.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2013-06-20 11:43:02 +0200
committerMiklos Szeredi <mszeredi@suse.cz>2013-07-01 10:06:37 +0200
commitddfd2d44a6eab79c722f4b5785efdbcccb9c4d35 (patch)
tree9d3b4d9ae8a687c97761b2200f448bf88ad2c53e /lib/mount_bsd.c
parent44088bc7fbe7c9234c090756dbf10742b1a281b1 (diff)
downloadlibfuse-ddfd2d44a6eab79c722f4b5785efdbcccb9c4d35.tar.gz
libfuse: fix multiple close of device fd
- fuse_kern_unmount closes handle (e.g. 19) - a thread in my process opens a file - the OS assigns newly freed handle (i.e. 19) - fuse_kern_chan_destroy closes the same handle (i.e. 19) - a thread in my process opens another file - the OS assigns newly freed handle (i.e. 19) - * MAYHEM * Reported by Dan Greenfield
Diffstat (limited to 'lib/mount_bsd.c')
-rw-r--r--lib/mount_bsd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/mount_bsd.c b/lib/mount_bsd.c
index 62443ac..3aec3e3 100644
--- a/lib/mount_bsd.c
+++ b/lib/mount_bsd.c
@@ -228,18 +228,21 @@ void fuse_kern_unmount(const char *mountpoint, int fd)
(void)mountpoint;
if (fstat(fd, &sbuf) == -1)
- return;
+ goto out;
devname_r(sbuf.st_rdev, S_IFCHR, dev, 128);
if (strncmp(dev, "fuse", 4))
- return;
+ goto out;
strtol(dev + 4, &ep, 10);
if (*ep != '\0')
- return;
+ goto out;
do_unmount(dev, fd);
+
+out:
+ close(fd);
}
/* Check if kernel is doing init in background */