From: Andi Shyti <andi.shyti@kernel.org>
To: Vasileios Almpanis <vasilisalmpanis@gmail.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
syzbot+23ad911c819b923238b7@syzkaller.appspotmail.com
Subject: Re: [PATCH v2] i2c: core: fix debugfs UAF on adapter removal
Date: Fri, 28 Aug 2026 03:15:33 +0200 [thread overview]
Message-ID: <apDhEq3fe6JWXVTE@zenone.zhora.eu> (raw)
In-Reply-To: <20260812-i2c-v2-1-5efaab4c3334@gmail.com>
Hi Vasileios,
On Wed, Aug 12, 2026 at 11:14:48AM +0200, Vasileios Almpanis wrote:
> i2c_del_adapter() frees the adapter's debugfs directory before it
> unregisters the adapter device, but the new_device sysfs attribute
> stays writable until device_del(). A write racing with removal still
> reaches i2c_device_probe(), which passes the freed adap->debugfs to
> debugfs_create_dir() as the new client's parent:
>
> BUG: KASAN: slab-use-after-free in lookup_noperm_common+0x407/0x430
> Read of size 4 at addr ffff88803ef87810 by task syz.0.61/6090
> lookup_noperm_common+0x407/0x430
> simple_start_creating+0x9c/0x110
> debugfs_start_creating+0xdb/0x1a0
> debugfs_create_dir+0x24/0x350
> i2c_device_probe+0x814/0xbf0
>
> Its technically possible to create a client after i2c_deregister_clients
> has run. That client will never be unregistered and making
> wait_for_completion hang.
>
> Close the window by removing the new_device attribute at the start of
> i2c_del_adapter(). device_remove_file() will drain any clients left.
>
> Fixes: 73febd775bdb ("i2c: create debugfs entry per adapter")
> Reported-by: syzbot+23ad911c819b923238b7@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=23ad911c819b923238b7
> Tested-by: syzbot+23ad911c819b923238b7@syzkaller.appspotmail.com
> Signed-off-by: Vasileios Almpanis <vasilisalmpanis@gmail.com>
with a few fixes in the commit messages, I pushed your patch to
i2c/i2c-fixes.
Thanks,
Andi
prev parent reply other threads:[~2026-08-28 1:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 9:14 Vasileios Almpanis
2026-08-28 1:15 ` Andi Shyti [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=apDhEq3fe6JWXVTE@zenone.zhora.eu \
--to=andi.shyti@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+23ad911c819b923238b7@syzkaller.appspotmail.com \
--cc=vasilisalmpanis@gmail.com \
--cc=wsa+renesas@sang-engineering.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®