[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20130726204727.416142495@linuxfoundation.org>
Date: Fri, 26 Jul 2013 13:47:37 -0700
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Miklos Szeredi <mszeredi@...e.cz>
Subject: [ 47/79] fuse: readdirplus: sanity checks
3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <mszeredi@...e.cz>
commit a28ef45cbb1e7fadd5159deb17b02de15c6e4aaf upstream.
Add sanity checks before adding or updating an entry with data received
from readdirplus.
Signed-off-by: Miklos Szeredi <mszeredi@...e.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
fs/fuse/dir.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1225,6 +1225,12 @@ static int fuse_direntplus_link(struct f
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 f
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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists