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: <DFMOIU3FC48L.17P3TCF92CEZZ@kernel.org>
Date: Mon, 12 Jan 2026 15:27:08 +0100
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Greg KH" <gregkh@...uxfoundation.org>
Cc: <rafael@...nel.org>, <igor.korotin.linux@...il.com>, <ojeda@...nel.org>,
 <boqun.feng@...il.com>, <gary@...yguo.net>, <bjorn3_gh@...tonmail.com>,
 <lossin@...nel.org>, <a.hindborg@...nel.org>, <aliceryhl@...gle.com>,
 <tmgross@...ch.edu>, <david.m.ertman@...el.com>, <ira.weiny@...el.com>,
 <leon@...nel.org>, <bhelgaas@...gle.com>, <kwilczynski@...nel.org>,
 <wsa+renesas@...g-engineering.com>, <linux-kernel@...r.kernel.org>,
 <rust-for-linux@...r.kernel.org>, <linux-pci@...r.kernel.org>,
 <linux-usb@...r.kernel.org>, <linux-i2c@...r.kernel.org>
Subject: Re: [PATCH 6/6] rust: driver: drop device private data post unbind

On Wed Jan 7, 2026 at 3:54 PM CET, Greg KH wrote:
> I say name it with "rust_" and take out the #ifdef, that makes it
> simpler/easier to understand.

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 2d9871503614..bea8da5f8a3a 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -548,10 +548,8 @@ static DEVICE_ATTR_RW(state_synced);
 static void device_unbind_cleanup(struct device *dev)
 {
        devres_release_all(dev);
-#ifdef CONFIG_RUST
-       if (dev->driver->p_cb.post_unbind)
-               dev->driver->p_cb.post_unbind(dev);
-#endif
+       if (dev->driver->p_cb.post_unbind_rust)
+               dev->driver->p_cb.post_unbind_rust(dev);
        arch_teardown_dma_ops(dev);
        kfree(dev->dma_range_map);
        dev->dma_range_map = NULL;
diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h
index 51a9ebdd8a2d..bbc67ec513ed 100644
--- a/include/linux/device/driver.h
+++ b/include/linux/device/driver.h
@@ -121,15 +121,13 @@ struct device_driver {
        void (*coredump) (struct device *dev);

        struct driver_private *p;
-#ifdef CONFIG_RUST
        struct {
                /*
                 * Called after remove() and after all devres entries have been
-                * processed.
+                * processed. This is a Rust only callback.
                 */
-               void (*post_unbind)(struct device *dev);
+               void (*post_unbind_rust)(struct device *dev);
        } p_cb;
-#endif
 };


diff --git a/rust/kernel/driver.rs b/rust/kernel/driver.rs
index 6e32376d4c7c..26095d7bd0d9 100644
--- a/rust/kernel/driver.rs
+++ b/rust/kernel/driver.rs
@@ -207,7 +207,7 @@ fn callbacks_attach(drv: &Opaque<T::DriverType>) {
         let base = base.cast::<bindings::device_driver>();

         // SAFETY: It is safe to set the fields of `struct device_driver` on initialization.
-        unsafe { (*base).p_cb.post_unbind = Some(Self::post_unbind_callback) };
+        unsafe { (*base).p_cb.post_unbind_rust = Some(Self::post_unbind_callback) };
     }

     /// Creates a new instance of the registration object.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ