All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lizhi Xu <lizhi.xu@windriver.com>
To: <syzbot+7a3d75905ea1a830dbe5@syzkaller.appspotmail.com>
Cc: <asmadeus@codewreck.org>, <ericvh@kernel.org>,
	<linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux_oss@crudebyte.com>, <lucho@ionkov.net>,
	<syzkaller-bugs@googlegroups.com>, <v9fs@lists.linux.dev>
Subject: [PATCH next] fs/9p: fix uaf in in v9fs_stat2inode_dotl
Date: Fri, 2 Feb 2024 20:15:31 +0800	[thread overview]
Message-ID: <20240202121531.2550018-1-lizhi.xu@windriver.com> (raw)
In-Reply-To: <00000000000055ecb906105ed669@google.com>

The incorrect logical order of accessing the st object code in v9fs_fid_iget_dotl
is causing this uaf.

Fixes: 724a08450f74 ("fs/9p: simplify iget to remove unnecessary paths")
Reported-and-tested-by: syzbot+7a3d75905ea1a830dbe5@syzkaller.appspotmail.com
Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>
---
 fs/9p/vfs_inode_dotl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index ef9db3e03506..2b313fe7003e 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -78,11 +78,11 @@ struct inode *v9fs_fid_iget_dotl(struct super_block *sb, struct p9_fid *fid)
 
 	retval = v9fs_init_inode(v9ses, inode, &fid->qid,
 				 st->st_mode, new_decode_dev(st->st_rdev));
+	v9fs_stat2inode_dotl(st, inode, 0);
 	kfree(st);
 	if (retval)
 		goto error;
 
-	v9fs_stat2inode_dotl(st, inode, 0);
 	v9fs_set_netfs_context(inode);
 	v9fs_cache_inode_get_cookie(inode);
 	retval = v9fs_get_acl(inode, fid);
-- 
2.43.0


  parent reply	other threads:[~2024-02-02 12:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02  4:49 [syzbot] [v9fs?] KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl syzbot
2024-02-02  8:35 ` Lizhi Xu
2024-02-02  9:08   ` syzbot
2024-02-02  8:41 ` Lizhi Xu
2024-02-02 12:08   ` syzbot
2024-02-02 12:15 ` Lizhi Xu [this message]
2024-02-28 10:33   ` [PATCH next] fs/9p: fix uaf in " Breno Leitao
2024-03-04 13:02   ` asmadeus
2024-03-22  1:28     ` Jakub Kicinski
2024-03-22 14:26       ` Eric Van Hensbergen
2024-03-22 15:13         ` Jakub Kicinski
2024-03-27 18:53           ` Jakub Kicinski
2024-03-27 19:02             ` Alexei Starovoitov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240202121531.2550018-1-lizhi.xu@windriver.com \
    --to=lizhi.xu@windriver.com \
    --cc=asmadeus@codewreck.org \
    --cc=ericvh@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux_oss@crudebyte.com \
    --cc=lucho@ionkov.net \
    --cc=syzbot+7a3d75905ea1a830dbe5@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=v9fs@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.