From: Andi Shyti <andi.shyti@kernel.org>
To: Vasileios Almpanis <vasilisalmpanis@gmail.com>
Cc: wsa+renesas@sang-engineering.com, johan@kernel.org,
hdanton@sina.com, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org,
syzbot+23ad911c819b923238b7@syzkaller.appspotmail.com
Subject: Re: [PATCH] i2c: core: fix debugfs UAF on adapter removal
Date: Fri, 31 Jul 2026 23:35:54 +0200 [thread overview]
Message-ID: <am0Mk1KapCw0SD1s@zenone.zhora.eu> (raw)
In-Reply-To: <20260730162540.291570-1-vasilisalmpanis@gmail.com>
Hi Vasileios,
...
> diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
> index 3ec04787a737..b894563f5a75 100644
> --- a/drivers/i2c/i2c-core-base.c
> +++ b/drivers/i2c/i2c-core-base.c
> @@ -1826,8 +1826,6 @@ void i2c_del_adapter(struct i2c_adapter *adap)
>
> i2c_host_notify_irq_teardown(adap);
>
> - debugfs_remove_recursive(adap->debugfs);
> -
> /* wait until all references to the device are gone
> *
> * FIXME: This is old code and should ideally be replaced by an
> @@ -1839,6 +1837,9 @@ void i2c_del_adapter(struct i2c_adapter *adap)
> device_unregister(&adap->dev);
> wait_for_completion(&adap->dev_released);
>
> + /* clients use this directory as their debugfs parent */
> + debugfs_remove_recursive(adap->debugfs);
> +
Speaking of sysfs, this can't work if a new device is created
through the new_device interface. Perhaps you can remove the
attribute first with device_remove_file(), but we need to check
whether that could lead to a double removal when the device
attributes are cleaned up during device removal.
Thanks,
Andi
> /* free bus id */
> mutex_lock(&core_lock);
> idr_remove(&i2c_adapter_idr, adap->nr);
> --
> 2.47.3
>
next prev parent reply other threads:[~2026-07-31 21:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 16:23 [PATCH] i2c: core: fix debugfs UAF on adapter removal Vasileios Almpanis
2026-07-31 21:35 ` Andi Shyti [this message]
2026-08-01 16:21 ` Vasileios Almpanis
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=am0Mk1KapCw0SD1s@zenone.zhora.eu \
--to=andi.shyti@kernel.org \
--cc=hdanton@sina.com \
--cc=johan@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