Re: [syzbot] Re: [syzbot] [ntfs3?] general protection fault in pick_link

From: syzbot
Date: Fri Nov 15 2024 - 03:26:43 EST


For archival purposes, forwarding an incoming command email to
linux-kernel@xxxxxxxxxxxxxxx.

***

Subject: Re: [syzbot] [ntfs3?] general protection fault in pick_link
Author: lizhi.xu@xxxxxxxxxxxxx

the symlink inode is corrupted.

#syz test

diff --git a/fs/namei.c b/fs/namei.c
index 4a4a22a08ac2..f5dbccb3aafc 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1844,6 +1844,9 @@ static const char *pick_link(struct nameidata *nd, struct path *link,
if (unlikely(error))
return ERR_PTR(error);

+ if (!S_ISLNK(inode->i_mode))
+ return ERR_PTR(-EINVAL);
+
res = READ_ONCE(inode->i_link);
if (!res) {
const char * (*get)(struct dentry *, struct inode *,