VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   32 Branches   54 Tags
author: Amir Goldstein <amir73il@gmail.com> 2021-06-21 14:03:53 +0300 committer: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 2021-07-20 16:00:24 +0200 commit: c09a4ad6251f9354df0915ac5b8f22c7b9d6bc11 parent: 6ba041fc3c441e0cf4762f4baf0166e8d34f6802
Commit Summary:
fuse: fix illegal access to inode with reused nodeid
Diffstat:
1 file changed, 5 insertions, 2 deletions
diff --git a/fs/fuse/readdir.c b/fs/fuse/readdir.c
index 277f7041d55a..bc267832310c 100644
--- a/fs/fuse/readdir.c
+++ b/fs/fuse/readdir.c
@@ -200,9 +200,12 @@ retry:
 	if (!d_in_lookup(dentry)) {
 		struct fuse_inode *fi;
 		inode = d_inode(dentry);
+		if (inode && get_node_id(inode) != o->nodeid)
+			inode = NULL;
 		if (!inode ||
-		    get_node_id(inode) != o->nodeid ||
-		    inode_wrong_type(inode, o->attr.mode)) {
+		    fuse_stale_inode(inode, o->generation, &o->attr)) {
+			if (inode)
+				fuse_make_bad(inode);
 			d_invalidate(dentry);
 			dput(dentry);
 			goto retry;