* [PATCH] FUSE: Validate rootmode mount option
@ 2007-04-02 20:47 Timo Savola
2007-04-02 22:31 ` Miklos Szeredi
0 siblings, 1 reply; 2+ messages in thread
From: Timo Savola @ 2007-04-02 20:47 UTC (permalink / raw)
To: miklos; +Cc: linux-kernel, fuse-devel
If rootmode doesn't include any file type bits, we hit the BUG() in
fuse_init_inode. Now EINVAL is returned.
Signed-off-by: Timo Savola <tsavola@movial.fi>
---
fs/fuse/inode.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 5ab8e50..503c9cd 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -330,6 +330,8 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev)
case OPT_ROOTMODE:
if (match_octal(&args[0], &value))
return 0;
+ if ((value & S_IFMT) == 0)
+ return 0;
d->rootmode = value;
d->rootmode_present = 1;
break;
--
1.4.4.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] FUSE: Validate rootmode mount option
2007-04-02 20:47 [PATCH] FUSE: Validate rootmode mount option Timo Savola
@ 2007-04-02 22:31 ` Miklos Szeredi
0 siblings, 0 replies; 2+ messages in thread
From: Miklos Szeredi @ 2007-04-02 22:31 UTC (permalink / raw)
To: tsavola; +Cc: linux-kernel, fuse-devel
> If rootmode doesn't include any file type bits, we hit the BUG() in
> fuse_init_inode. Now EINVAL is returned.
Thanks, well spotted.
I'll queue this more complete fix.
Miklos
----
From: Timo Savola <tsavola@movial.fi>
Subject: fuse: validate rootmode mount option
If rootmode isn't valid, we hit the BUG() in fuse_init_inode. Now
EINVAL is returned.
Signed-off-by: Timo Savola <tsavola@movial.fi>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---
Index: linux/fs/fuse/inode.c
===================================================================
--- linux.orig/fs/fuse/inode.c 2007-03-21 18:44:43.000000000 +0100
+++ linux/fs/fuse/inode.c 2007-04-03 00:01:07.000000000 +0200
@@ -330,6 +330,8 @@ static int parse_fuse_opt(char *opt, str
case OPT_ROOTMODE:
if (match_octal(&args[0], &value))
return 0;
+ if (!fuse_valid_type(value))
+ return 0;
d->rootmode = value;
d->rootmode_present = 1;
break;
Index: linux/fs/fuse/dir.c
===================================================================
--- linux.orig/fs/fuse/dir.c 2007-03-21 18:44:43.000000000 +0100
+++ linux/fs/fuse/dir.c 2007-04-03 00:00:00.000000000 +0200
@@ -195,7 +195,7 @@ static struct dentry_operations fuse_den
.d_revalidate = fuse_dentry_revalidate,
};
-static int valid_mode(int m)
+int fuse_valid_type(int m)
{
return S_ISREG(m) || S_ISDIR(m) || S_ISLNK(m) || S_ISCHR(m) ||
S_ISBLK(m) || S_ISFIFO(m) || S_ISSOCK(m);
@@ -248,7 +248,8 @@ static struct dentry *fuse_lookup(struct
fuse_put_request(fc, req);
/* Zero nodeid is same as -ENOENT, but with valid timeout */
if (!err && outarg.nodeid &&
- (invalid_nodeid(outarg.nodeid) || !valid_mode(outarg.attr.mode)))
+ (invalid_nodeid(outarg.nodeid) ||
+ !fuse_valid_type(outarg.attr.mode)))
err = -EIO;
if (!err && outarg.nodeid) {
inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation,
Index: linux/fs/fuse/fuse_i.h
===================================================================
--- linux.orig/fs/fuse/fuse_i.h 2007-02-04 19:44:54.000000000 +0100
+++ linux/fs/fuse/fuse_i.h 2007-04-03 00:01:20.000000000 +0200
@@ -552,3 +552,8 @@ int fuse_ctl_add_conn(struct fuse_conn *
* Remove connection from control filesystem
*/
void fuse_ctl_remove_conn(struct fuse_conn *fc);
+
+/**
+ * Is file type valid?
+ */
+int fuse_valid_type(int m);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-04-02 22:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-02 20:47 [PATCH] FUSE: Validate rootmode mount option Timo Savola
2007-04-02 22:31 ` Miklos Szeredi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®