lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DG9QU6ZMT9B8.HYIDD2GJGZUH@kernel.org>
Date: Sun, 08 Feb 2026 18:07:19 +0100
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Igor Korotin" <igor.korotin@...ux.dev>
Cc: "Igor Korotin via B4 Relay"
 <devnull+igor.korotin.linux.gmail.com@...nel.org>,
 <igor.korotin.linux@...il.com>, "Daniel Almeida"
 <daniel.almeida@...labora.com>, "Miguel Ojeda" <ojeda@...nel.org>, "Boqun
 Feng" <boqun.feng@...il.com>, "Gary Guo" <gary@...yguo.net>,
 Björn Roy Baron <bjorn3_gh@...tonmail.com>, "Benno Lossin"
 <lossin@...nel.org>, "Andreas Hindborg" <a.hindborg@...nel.org>, "Alice
 Ryhl" <aliceryhl@...gle.com>, "Trevor Gross" <tmgross@...ch.edu>, "Wolfram
 Sang" <wsa+renesas@...g-engineering.com>, <linux-kernel@...r.kernel.org>,
 <rust-for-linux@...r.kernel.org>, <linux-i2c@...r.kernel.org>,
 <markus.probst@...teo.de>, <brgl@...nel.org>, <gregkh@...uxfoundation.org>,
 <rafael@...nel.org>, <driver-core@...ts.linux.dev>
Subject: Re: [PATCH 0/5] rust: extend I2C functionality

On Sun Feb 8, 2026 at 1:34 PM CET, Igor Korotin wrote:
> Hello Danilo
>
> On 1/31/2026 2:26 PM, Danilo Krummrich wrote:
>> (Cc: Bartosz, Greg, Rafael, driver-core)
>> 
>> On Sat Jan 31, 2026 at 3:12 PM CET, Igor Korotin via B4 Relay wrote:
>>> This patch series extend the existing I2C functionality with:
>>> - Abstractions allowing to implement I2C algorithms used by I2C adapters;
>>> - Abstractions allowing to create and add new I2C adapters;
>>> - Safe wrappers upon I2C and SMbus transferring C API: read/write
>>>    bytes/words/byte arrays.
>>>
>>> The patch series contains additional new sample driver `rust_i2c_adapter`
>>> presenting the new functionality.
>> 
>> The i2c_adapter code on the C side has some lifetime issues, Bartosz looks into
>> resolving.
>> 
>> My biggest concern is that struct i2c_adapter is a bus device implementation,
>> but does not use the reference count of the embedded struct device.
>> 
>> Instead, I2C bus drivers embedd the i2c_adapter in their driver specific
>> structure, which is typically freed in the I2C bus driver's remove() callback.
>> 
>> This violates struct device reference counts.
>> 
>> Until this is fixed, the Rust abstractions should probably work around this, to
>> subsequent painful rework.
>
> just to clarify what is currently implemented on the Rust side.
>
> The Rust I2cAdapter is required to be bound to a parent Device<Bound>. 
> The implementation keeps a reference to the embedded struct device 
> inside struct i2c_adapter for the entire lifetime of the Rust adapter, 
> so its lifetime is tied to the device model.
>
> I am not entirely sure which specific lifetime or refcounting scenario 
> you are referring to. If you have a concrete case in mind where this 
> would still be problematic, could you please point it out?

The implementation on the C side does not consider the reference count of the
embedded struct device, which is not correct.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ