From: weipeng <coderlogicwei@gmail.com>
To: oneukum@suse.com
Cc: anna-maria@linutronix.de, coderlogicwei@gmail.com,
frederic@kernel.org, linux-kernel@vger.kernel.org,
linux-usb@vger.kernel.org, syzkaller-bugs@googlegroups.com,
tglx@linutronix.de
Subject: Re: [syzbot] [usb?] INFO: task hung in i2c_tiny_usb_disconnect
Date: Wed, 14 Jan 2026 16:11:00 +0800 [thread overview]
Message-ID: <20260114081100.830758-1-coderlogicwei@gmail.com> (raw)
In-Reply-To: <a53fa501-dff1-4732-92c1-fab8e66ef886@suse.com>
On 2026-01-13 20:23, Oliver Neukum wrote:
> what prevents the following sequence:
>
> i2c_tiny_usb_disconnect() -> module unload -> i2c_tiny_usb_release()
>
> As far as I can tell, this can happen and you'd execute already
> freed memory.
Hi,
I got it. It can be solved by using wait_for_completion in the module exit
function to wait for all the i2c_tiny_usb_release() to be done.
But after think twice, I think it is not a good idea. Because that would be
too complicated for a driver. Almost all the usb drivers does not do like this.
They just call release functions in the disconnect() rather than put all the
release works to another task. So I think the key point is not the disconnect().
The key point is the i2c subsystem:
> void i2c_del_adapter(struct i2c_adapter *adap)
> {
> ...
> /* wait until all references to the device are gone
> *
> * FIXME: This is old code and should ideally be replaced by an
> * alternative which results in decoupling the lifetime of the struct
> * device from the i2c_adapter, like spi or netdev do. Any solution
> * should be thoroughly tested with DEBUG_KOBJECT_RELEASE enabled!
> */
> init_completion(&adap->dev_released);
> device_unregister(&adap->dev);
> wait_for_completion(&adap->dev_released);
> ...
> }
The i2c_del_adapter() will wait for all the users to put the reference of the adapter.
It is not a good idea. We can't control the users. So the i2c_del_adapter() can wait
for any time.
Best Regards
weipeng
next prev parent reply other threads:[~2026-01-14 8:11 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-11 16:32 [syzbot] [usb?] INFO: task hung in i2c_tiny_usb_disconnect syzbot
2026-01-12 13:11 ` Wei Peng
2026-01-12 13:24 ` syzbot
2026-01-12 13:31 ` Wei Peng
2026-01-12 13:38 ` Wei Peng
2026-01-12 13:41 ` syzbot
2026-01-13 3:11 ` weipeng
2026-01-13 4:22 ` syzbot
2026-01-13 6:25 ` weipeng
2026-01-13 7:28 ` syzbot
2026-01-13 7:52 ` weipeng
2026-01-13 8:35 ` syzbot
2026-01-13 9:49 ` Oliver Neukum
2026-01-13 15:35 ` weipeng
2026-01-13 15:45 ` weipeng
2026-01-13 15:47 ` weipeng
2026-01-13 16:18 ` syzbot
2026-01-13 20:23 ` Oliver Neukum
2026-01-14 8:11 ` weipeng [this message]
2026-01-14 8:26 ` Oliver Neukum
2026-01-14 8:51 ` weipeng
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=20260114081100.830758-1-coderlogicwei@gmail.com \
--to=coderlogicwei@gmail.com \
--cc=anna-maria@linutronix.de \
--cc=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=oneukum@suse.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=tglx@linutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.