diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2013-07-17 14:53:53 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-28 16:30:08 -0700 |
commit | 223828d8a6ef53f7671351fe5d08f18dca714830 (patch) | |
tree | 6a450f60b7fae6d7d37aab0637719f0cecfe7df9 /fs | |
parent | dc2a6c2d3e9a2529b3ffc70c165cbb10c85768f5 (diff) | |
download | kernel-common-223828d8a6ef53f7671351fe5d08f18dca714830.tar.gz kernel-common-223828d8a6ef53f7671351fe5d08f18dca714830.tar.bz2 kernel-common-223828d8a6ef53f7671351fe5d08f18dca714830.zip |
fuse: readdirplus: sanity checks
commit a28ef45cbb1e7fadd5159deb17b02de15c6e4aaf upstream.
Add sanity checks before adding or updating an entry with data received
from readdirplus.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fuse/dir.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index a71df0206f6f..5b1274699b08 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1225,6 +1225,12 @@ static int fuse_direntplus_link(struct file *file, if (name.name[1] == '.' && name.len == 2) return 0; } + + if (invalid_nodeid(o->nodeid)) + return -EIO; + if (!fuse_valid_type(o->attr.mode)) + return -EIO; + fc = get_fuse_conn(dir); name.hash = full_name_hash(name.name, name.len); @@ -1233,10 +1239,14 @@ static int fuse_direntplus_link(struct file *file, inode = dentry->d_inode; if (!inode) { d_drop(dentry); - } else if (get_node_id(inode) != o->nodeid) { + } else if (get_node_id(inode) != o->nodeid || + ((o->attr.mode ^ inode->i_mode) & S_IFMT)) { err = d_invalidate(dentry); if (err) goto out; + } else if (is_bad_inode(inode)) { + err = -EIO; + goto out; } else { struct fuse_inode *fi; fi = get_fuse_inode(inode); |