summaryrefslogtreecommitdiff
path: root/sys/miscfs
diff options
context:
space:
mode:
authorsyl <syl@cvs.openbsd.org>2013-07-11 11:38:11 +0000
committersyl <syl@cvs.openbsd.org>2013-07-11 11:38:11 +0000
commite910acc1c82238c0f5107464ffb55739430ba0d7 (patch)
tree00ae2767cdb42b4a8ae80559ad4a9328bf4eeaca /sys/miscfs
parentdcc538a3a4f8134b9585f37efa8cfb40cdb46f87 (diff)
Fix a panic on multiple fuse device access.
ok tedu@
Diffstat (limited to 'sys/miscfs')
-rw-r--r--sys/miscfs/fuse/fuse_device.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/miscfs/fuse/fuse_device.c b/sys/miscfs/fuse/fuse_device.c
index ee2ad9c860c..97ded0fc801 100644
--- a/sys/miscfs/fuse/fuse_device.c
+++ b/sys/miscfs/fuse/fuse_device.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fuse_device.c,v 1.3 2013/06/21 21:30:38 syl Exp $ */
+/* $OpenBSD: fuse_device.c,v 1.4 2013/07/11 11:38:10 syl Exp $ */
/*
* Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
@@ -273,6 +273,7 @@ fuseread(dev_t dev, struct uio *uio, int ioflag)
{
struct fuse_d *fd;
struct fusebuf *fbuf;
+ struct fb_hdr hdr;
int error = 0;
char *F_dat;
int remain;
@@ -301,7 +302,9 @@ fuseread(dev_t dev, struct uio *uio, int ioflag)
if (uio->uio_resid < len)
return (EINVAL);
- error = uiomove(fbuf, len, uio);
+ memcpy(&hdr, &fbuf->fb_hdr, sizeof(hdr));
+ bzero(&hdr.fh_next, sizeof(hdr.fh_next));
+ error = uiomove(&hdr, len, uio);
if (error)
goto end;
@@ -380,7 +383,9 @@ fusewrite(dev_t dev, struct uio *uio, int ioflag)
#endif
if (fbuf != NULL) {
- memcpy(&fbuf->fb_hdr, &hdr, sizeof(fbuf->fb_hdr));
+ fbuf->fb_len = hdr.fh_len;
+ fbuf->fb_err = hdr.fh_err;
+ fbuf->fb_ino = hdr.fh_ino;
if (uio->uio_resid != hdr.fh_len ||
(uio->uio_resid != 0 && hdr.fh_err) ||