mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dominique Martinet <asmadeus@codewreck.org>
To: Yuanfu Xie <yuanfuxie@stu.pku.edu.cn>
Cc: v9fs@lists.linux.dev, Eric Van Hensbergen <ericvh@kernel.org>,
	Latchesar Ionkov <lucho@ionkov.net>,
	Christian Schoenebeck <linux_oss@crudebyte.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 9p: do not store the create fid on special files
Date: Thu, 29 Oct 2026 12:10:04 +0900	[thread overview]
Message-ID: <auK5DISBP3Nmls1I@codewreck.org> (raw)
In-Reply-To: <92377346-29E9-46D3-96F5-AABA8A64CD57@stu.pku.edu.cn>

Yuanfu Xie wrote on Tue, Sep 22, 2026 at 09:16:22PM +0800:
> v9fs_vfs_atomic_open_dotl() always stores the create fid in
> file->private_data after finish_open().  FIFO and device inodes
> already have type-specific file_operations that own that field.
> Overwriting it with the fid makes later read/write/close treat the
> p9_fid as a pipe_inode_info, which corrupts the fid and can use it
> after it has been clunked.  The non-dotl atomic_open path does not
> assign the fid this way.
> 
> Only attach the fid for regular files and directories.  Special
> files do not need the create fid; leave it for the existing
> p9_fid_put() on the out path so it is clunked before return.
> 
> KASAN report, linux-stable 4982d3552a3b:
> 
> BUG: KASAN: slab-use-after-free in anon_pipe_prefill_and_lock+0x376/0x3f0
> Read of size 4 at addr ffff88800ab30538 by task repro/1
> 
> Call Trace:
>  <TASK>
>  anon_pipe_prefill_and_lock+0x376/0x3f0
>  anon_pipe_write+0x127/0x1600
>  fifo_pipe_write+0x24/0x300
>  vfs_write+0x659/0xd00
>  ksys_write+0x10f/0x200
>  do_syscall_64+0xdd/0x4a0
>  </TASK>
> 
> Fixes: 30d904947459 ("kill struct opendata")
> Signed-off-by: Yuanfu Xie <yuanfuxie@stu.pku.edu.cn>

Thanks, also picked up

-- 
Dominique Martinet | Asmadeus

      reply	other threads:[~2026-10-29  3:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 13:16 Yuanfu Xie
2026-10-29  3:10 ` Dominique Martinet [this message]

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=auK5DISBP3Nmls1I@codewreck.org \
    --to=asmadeus@codewreck.org \
    --cc=ericvh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux_oss@crudebyte.com \
    --cc=lucho@ionkov.net \
    --cc=v9fs@lists.linux.dev \
    --cc=yuanfuxie@stu.pku.edu.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®