From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+b91eb2ed18f599dd3c31@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [fs?] KASAN: slab-use-after-free Read in sys_io_cancel
Date: Mon, 4 Mar 2024 22:07:02 +0800 [thread overview]
Message-ID: <20240304140702.1457-1-hdanton@sina.com> (raw)
In-Reply-To: <0000000000006945730612bc9173@google.com>
On Sat, 02 Mar 2024 23:29:23 -0800
> syzbot found the following issue on:
>
> HEAD commit: 5ad3cb0ed525 Merge tag 'for-v6.8-rc2' of git://git.kernel...
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13877412180000
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
--- x/fs/aio.c
+++ y/fs/aio.c
@@ -2194,6 +2194,8 @@ SYSCALL_DEFINE3(io_cancel, aio_context_t
list_for_each_entry(kiocb, &ctx->active_reqs, ki_list) {
if (kiocb->ki_res.obj == obj) {
ret = kiocb->ki_cancel(&kiocb->rw);
+ if (ret == 0)
+ refcount_inc(&kiocb->ki_refcnt);
list_del_init(&kiocb->ki_list);
break;
}
@@ -2204,8 +2206,11 @@ SYSCALL_DEFINE3(io_cancel, aio_context_t
* The result argument is no longer used - the io_event is always
* delivered via the ring buffer.
*/
- if (ret == 0 && kiocb->rw.ki_flags & IOCB_AIO_RW)
- aio_complete_rw(&kiocb->rw, -EINTR);
+ if (ret == 0)
+ if (kiocb->rw.ki_flags & IOCB_AIO_RW)
+ aio_complete_rw(&kiocb->rw, -EINTR);
+ else
+ iocb_put(kiocb);
percpu_ref_put(&ctx->users);
--
next prev parent reply other threads:[~2024-03-04 14:08 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-03 7:29 syzbot
2024-03-03 9:53 ` Edward Adam Davis
2024-03-03 10:22 ` syzbot
2024-03-03 11:33 ` Edward Adam Davis
2024-03-03 11:50 ` syzbot
2024-03-03 12:21 ` [PATCH] fs/aio: fix uaf " Edward Adam Davis
2024-03-04 16:15 ` Bart Van Assche
2024-03-04 17:03 ` Benjamin LaHaise
2024-03-04 17:15 ` Bart Van Assche
2024-03-04 17:31 ` Benjamin LaHaise
2024-03-04 17:40 ` Bart Van Assche
2024-03-04 17:47 ` Benjamin LaHaise
2024-03-04 17:58 ` Bart Van Assche
2024-03-04 18:02 ` Benjamin LaHaise
2024-03-04 10:44 ` [syzbot] [fs?] KASAN: slab-use-after-free Read " Hillf Danton
2024-03-04 13:33 ` syzbot
2024-03-04 14:07 ` Hillf Danton [this message]
2024-03-04 14:57 ` syzbot
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=20240304140702.1457-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+b91eb2ed18f599dd3c31@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
all inboxes | Powered by JetHome®