Linux I2C development
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@kernel.org>
To: Yun Zhou <yun.zhou@windriver.com>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i2c: fix use-after-free in debugfs directory during adapter removal
Date: Fri, 31 Jul 2026 23:55:47 +0200	[thread overview]
Message-ID: <am0YZFhbzuze-rd8@zenone.zhora.eu> (raw)
In-Reply-To: <20260729085853.1624451-1-yun.zhou@windriver.com>

Hi Yun,

On Wed, Jul 29, 2026 at 04:58:53PM +0800, Yun Zhou wrote:
> Move debugfs_remove_recursive() after device_unregister() in
> i2c_del_adapter() to fix a race condition where a new i2c device probe
> can access the adapter's already-freed debugfs dentry.
> 
> The race occurs when:
> 1. i2c_del_adapter() calls debugfs_remove_recursive(adap->debugfs),
>    freeing the debugfs dentry.
> 2. Before device_unregister() completes, another thread writes to the
>    sysfs 'new_device' attribute, triggering i2c_device_probe().
> 3. i2c_device_probe() calls debugfs_create_dir() with the stale
>    adapter->debugfs pointer, causing a GPF in start_dirop() when
>    trying to lock the freed inode.
> 
> Reported-by: syzbot+1e3d934ee3cff1ac188b@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=1e3d934ee3cff1ac188b
> Fixes: 73febd775bdb ("i2c: create debugfs entry per adapter")
> Cc: stable@vger.kernel.org
> Signed-off-by: Yun Zhou <yun.zhou@windriver.com>

This is the third patch of this kind I've reviewed, starting from
the latest. I'm sorry, but I don't need AI to send me patches; I
can do that myself. I don't need intermediaries.

If your goal is to be replaced by AI, you're doing a pretty good
job.

I'm NAKing this patch on principle. Read your second patch to
understand why; read your own patches and understand them before
sending.

Andi

  reply	other threads:[~2026-07-31 21:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29  8:58 [PATCH] i2c: fix use-after-free in debugfs directory during adapter removal Yun Zhou
2026-07-31 21:55 ` Andi Shyti [this message]
2026-08-01  3:49   ` Hillf Danton

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=am0YZFhbzuze-rd8@zenone.zhora.eu \
    --to=andi.shyti@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yun.zhou@windriver.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