From 2c338af141068b1fbc4e4ead7056e3b8234e6f4d Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sat, 6 Apr 2019 18:04:04 +0000 Subject: [PATCH] fusefs: fix a panic on mount Don't page fault if the file descriptor provided with "-o fd" is invalid. This is a merge of r345419 from the projects/fuse2 branch. Reviewed by: ngie Tested by: Marek Zarychta MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19836 --- sys/fs/fuse/fuse_vfsops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/fs/fuse/fuse_vfsops.c b/sys/fs/fuse/fuse_vfsops.c index 6fdc904bedd..bf54df32e74 100644 --- a/sys/fs/fuse/fuse_vfsops.c +++ b/sys/fs/fuse/fuse_vfsops.c @@ -225,7 +225,7 @@ fuse_vfsop_mount(struct mount *mp) size_t len; struct cdev *fdev; - struct fuse_data *data; + struct fuse_data *data = NULL; struct thread *td; struct file *fp, *fptmp; char *fspec, *subtype; @@ -361,7 +361,7 @@ fuse_vfsop_mount(struct mount *mp) out: if (err) { FUSE_LOCK(); - if (data->mp == mp) { + if (data != NULL && data->mp == mp) { /* * Destroy device only if we acquired reference to * it