From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+e1dc29a4daf3f8051130@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [netfs?] KASAN: slab-use-after-free Write in io_submit_one
Date: Sat, 15 Feb 2025 15:43:39 +0800 [thread overview]
Message-ID: <20250215074343.2302-1-hdanton@sina.com> (raw)
In-Reply-To: <67aedac7.050a0220.21dd3.002d.GAE@google.com>
On Thu, 13 Feb 2025 21:55:19 -0800
> syzbot found the following issue on:
>
> HEAD commit: 69b54314c975 Merge tag 'kbuild-fixes-v6.14' of git://git.k..
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10fcbb18580000
#syz test upstream master
--- x/fs/netfs/read_collect.c
+++ y/fs/netfs/read_collect.c
@@ -289,6 +289,10 @@ reassess:
/* Remove if completely consumed. */
stream->source = front->source;
spin_lock(&rreq->lock);
+ if (front != stream->front) {
+ spin_unlock(&rreq->lock);
+ goto reassess;
+ }
remove = front;
trace_netfs_sreq(front, netfs_sreq_trace_discard);
@@ -345,6 +349,7 @@ static void netfs_rreq_assess_dio(struct
struct netfs_io_subrequest *subreq;
struct netfs_io_stream *stream = &rreq->io_streams[0];
unsigned int i;
+ struct kiocb *iocb = NULL;
/* Collect unbuffered reads and direct reads, adding up the transfer
* sizes until we find the first short or failed subrequest.
@@ -369,12 +374,16 @@ static void netfs_rreq_assess_dio(struct
}
}
+ spin_lock(&rreq->lock);
if (rreq->iocb) {
rreq->iocb->ki_pos += rreq->transferred;
if (rreq->iocb->ki_complete)
- rreq->iocb->ki_complete(
- rreq->iocb, rreq->error ? rreq->error : rreq->transferred);
+ iocb = rreq->iocb;
+ rreq->iocb = NULL;
}
+ spin_unlock(&rreq->lock);
+ if (iocb)
+ iocb->ki_complete(iocb, rreq->error ? rreq->error : rreq->transferred);
if (rreq->netfs_ops->done)
rreq->netfs_ops->done(rreq);
if (rreq->origin == NETFS_DIO_READ)
--
next prev parent reply other threads:[~2025-02-15 7:44 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-14 5:55 [syzbot] [netfs?] KASAN: slab-use-after-free Write in io_submit_one syzbot
2025-02-14 12:46 ` Edward Adam Davis
2025-02-14 12:57 ` [syzbot] " syzbot
2025-02-15 0:59 ` Edward Adam Davis
2025-02-15 1:23 ` [syzbot] " syzbot
2025-02-15 2:00 ` Edward Adam Davis
2025-02-15 2:19 ` [syzbot] " syzbot
2025-02-15 2:36 ` Edward Adam Davis
2025-02-15 2:57 ` [syzbot] " syzbot
2025-02-15 3:50 ` Edward Adam Davis
2025-02-15 3:51 ` [syzbot] " syzbot
2025-02-15 4:10 ` Edward Adam Davis
2025-02-15 4:32 ` [syzbot] " syzbot
2025-02-15 5:15 ` Edward Adam Davis
2025-02-15 5:38 ` [syzbot] " syzbot
2025-02-15 7:43 ` Hillf Danton [this message]
2025-02-15 8:10 ` syzbot
2025-02-15 9:42 ` [PATCH] netfs: Prevent race conditions between aio read and read collection worker Edward Adam Davis
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=20250215074343.2302-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+e1dc29a4daf3f8051130@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/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