Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[PATCH] fuse: check for invalid node ID in fuse_create_open()

Check for invalid node ID values in the new atomic create+open method.

Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Miklos Szeredi and committed by
Linus Torvalds
2827d0b2 f007d5c9

+8 -3
+8 -3
fs/fuse/dir.c
··· 87 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 95 static struct dentry_operations fuse_dentry_operations = { 91 96 .d_revalidate = fuse_dentry_revalidate, 92 97 }; ··· 115 110 fuse_lookup_init(req, dir, entry, &outarg); 116 111 request_send(fc, req); 117 112 err = req->out.h.error; 118 - if (!err && (!outarg.nodeid || outarg.nodeid == FUSE_ROOT_ID)) 113 + if (!err && invalid_nodeid(outarg.nodeid)) 119 114 err = -EIO; 120 115 if (!err) { 121 116 inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation, ··· 211 206 } 212 207 213 208 err = -EIO; 214 - if (!S_ISREG(outentry.attr.mode)) 209 + if (!S_ISREG(outentry.attr.mode) || invalid_nodeid(outentry.nodeid)) 215 210 goto out_free_ff; 216 211 217 212 inode = fuse_iget(dir->i_sb, outentry.nodeid, outentry.generation, ··· 268 263 fuse_put_request(fc, req); 269 264 return err; 270 265 } 271 - if (!outarg.nodeid || outarg.nodeid == FUSE_ROOT_ID) { 266 + if (invalid_nodeid(outarg.nodeid)) { 272 267 fuse_put_request(fc, req); 273 268 return -EIO; 274 269 }