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-next>] [day] [month] [year] [list]
Message-Id: <20251223-i2c-ada-dev-set-node-v1-0-2e36e0e785b4@oss.qualcomm.com>
Date: Tue, 23 Dec 2025 11:06:47 +0100
From: Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>
To: Wolfram Sang <wsa+renesas@...g-engineering.com>,
        Mika Westerberg <mika.westerberg@...ux.intel.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Jan Dabros <jsd@...ihalf.com>, Andi Shyti <andi.shyti@...nel.org>,
        Lixu Zhang <lixu.zhang@...el.com>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Binbin Zhou <zhoubinbin@...ngson.cn>,
        Fabrizio Castro <fabrizio.castro.jz@...esas.com>,
        Israel Cepeda <israel.a.cepeda.lopez@...el.com>,
        Hans de Goede <hansg@...nel.org>
Cc: Bartosz Golaszewski <brgl@...nel.org>, linux-i2c@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
        Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>
Subject: [PATCH 0/7] i2c: provide and use i2c_adapter_set_node()

It's been another year of discussing the object life-time problems at
conferences. I2C is one of the offenders and its problems are more
complex than those of some other subsystems. It seems the revocable[1]
API may make its way into the kernel this year but even with it in
place, I2C won't be able to use it as there's currently nothing to
*revoke*. The struct device is embedded within the i2c_adapter struct
whose lifetime is tied to the provider device being bound to its driver.

Fixing this won't be fast and easy but nothing's going to happen if we
don't start chipping away at it. The ultimate goal in order to be able
to use an SRCU-based solution (revocable or otherwise) is to convert the
embedded struct device in struct i2c_adapter into an __rcu pointer that
can be *revoked*. To that end we need to hide all dereferences of
adap->dev in drivers.

I2C drivers use device_set_node() to assign a firmware node directly to
the struct device embedded in i2c_adapter. In order to hide the direct
dereferencing: provide a dedicated interface that wraps the call to
device_set_node() but takes the adapter as argument instead.

[1] https://lore.kernel.org/all/20251106152330.11733-1-tzungbi@kernel.org/

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>
---
Bartosz Golaszewski (7):
      i2c: provide i2c_adapter_set_node()
      i2c: designware-common: use i2c_adapter_set_node()
      i2c: gpio: use i2c_adapter_set_node()
      i2c: ljca: use i2c_adapter_set_node()
      i2c: ls2x: use i2c_adapter_set_node()
      i2c: rzv2m: use i2c_adapter_set_node()
      i2c: usbio: use i2c_adapter_set_node()

 drivers/i2c/busses/i2c-designware-common.c | 2 +-
 drivers/i2c/busses/i2c-gpio.c              | 2 +-
 drivers/i2c/busses/i2c-ljca.c              | 2 +-
 drivers/i2c/busses/i2c-ls2x.c              | 2 +-
 drivers/i2c/busses/i2c-rzv2m.c             | 2 +-
 drivers/i2c/busses/i2c-usbio.c             | 2 +-
 include/linux/i2c.h                        | 7 +++++++
 7 files changed, 13 insertions(+), 6 deletions(-)
---
base-commit: 9448598b22c50c8a5bb77a9103e2d49f134c9578
change-id: 20251223-i2c-ada-dev-set-node-0636a8d3666c

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ