diff options
Diffstat (limited to 'fs/fuse')
-rw-r--r-- | fs/fuse/dir.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 3a47247a889e..51f5da652771 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -87,6 +87,11 @@ static int dir_alias(struct inode *inode) | |||
87 | return 0; | 87 | return 0; |
88 | } | 88 | } |
89 | 89 | ||
90 | static inline int invalid_nodeid(u64 nodeid) | ||
91 | { | ||
92 | return !nodeid || nodeid == FUSE_ROOT_ID; | ||
93 | } | ||
94 | |||
90 | static struct dentry_operations fuse_dentry_operations = { | 95 | static struct dentry_operations fuse_dentry_operations = { |
91 | .d_revalidate = fuse_dentry_revalidate, | 96 | .d_revalidate = fuse_dentry_revalidate, |
92 | }; | 97 | }; |
@@ -110,7 +115,7 @@ static int fuse_lookup_iget(struct inode *dir, struct dentry *entry, | |||
110 | fuse_lookup_init(req, dir, entry, &outarg); | 115 | fuse_lookup_init(req, dir, entry, &outarg); |
111 | request_send(fc, req); | 116 | request_send(fc, req); |
112 | err = req->out.h.error; | 117 | err = req->out.h.error; |
113 | if (!err && (!outarg.nodeid || outarg.nodeid == FUSE_ROOT_ID)) | 118 | if (!err && invalid_nodeid(outarg.nodeid)) |
114 | err = -EIO; | 119 | err = -EIO; |
115 | if (!err) { | 120 | if (!err) { |
116 | inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation, | 121 | inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation, |
@@ -206,7 +211,7 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode, | |||
206 | } | 211 | } |
207 | 212 | ||
208 | err = -EIO; | 213 | err = -EIO; |
209 | if (!S_ISREG(outentry.attr.mode)) | 214 | if (!S_ISREG(outentry.attr.mode) || invalid_nodeid(outentry.nodeid)) |
210 | goto out_free_ff; | 215 | goto out_free_ff; |
211 | 216 | ||
212 | inode = fuse_iget(dir->i_sb, outentry.nodeid, outentry.generation, | 217 | inode = fuse_iget(dir->i_sb, outentry.nodeid, outentry.generation, |
@@ -263,7 +268,7 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req, | |||
263 | fuse_put_request(fc, req); | 268 | fuse_put_request(fc, req); |
264 | return err; | 269 | return err; |
265 | } | 270 | } |
266 | if (!outarg.nodeid || outarg.nodeid == FUSE_ROOT_ID) { | 271 | if (invalid_nodeid(outarg.nodeid)) { |
267 | fuse_put_request(fc, req); | 272 | fuse_put_request(fc, req); |
268 | return -EIO; | 273 | return -EIO; |
269 | } | 274 | } |