Skip to content

Commit 68ca1b4

Browse files
author
Miklos Szeredi
committed
fuse: fix root lookup with nonzero generation
The root inode has a fixed nodeid and generation (1, 0). Prior to the commit 15db168 ("fuse: fix illegal access to inode with reused nodeid") generation number on lookup was ignored. After this commit lookup with the wrong generation number resulted in the inode being unhashed. This is correct for non-root inodes, but replacing the root inode is wrong and results in weird behavior. Fix by reverting to the old behavior if ignoring the generation for the root inode, but issuing a warning in dmesg. Reported-by: Antonio SJ Musumeci <[email protected]> Closes: https://lore.kernel.org/all/CAOQ4uxhek5ytdN8Yz2tNEOg5ea4NkBb4nk0FGPjPk_9nz-VG3g@mail.gmail.com/ Fixes: 15db168 ("fuse: fix illegal access to inode with reused nodeid") Cc: <[email protected]> # v5.14 Signed-off-by: Miklos Szeredi <[email protected]>
1 parent 82e081a commit 68ca1b4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/fuse/dir.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,10 @@ int fuse_lookup_name(struct super_block *sb, u64 nodeid, const struct qstr *name
391391
err = -EIO;
392392
if (fuse_invalid_attr(&outarg->attr))
393393
goto out_put_forget;
394+
if (outarg->nodeid == FUSE_ROOT_ID && outarg->generation != 0) {
395+
pr_warn_once("root generation should be zero\n");
396+
outarg->generation = 0;
397+
}
394398

395399
*inode = fuse_iget(sb, outarg->nodeid, outarg->generation,
396400
&outarg->attr, ATTR_TIMEOUT(outarg),

0 commit comments

Comments
 (0)