rust: i2c: do not drop device private data on shutdown()

We must not drop the device private data on shutdown(); none of the
registrations attached to devres that might access the device private
data are released before shutdown() is called.

Hence, freeing the device private data on shutdown() can cause UAF bugs.

Fixes: 57c5bd9aee94 ("rust: i2c: add basic I2C device and driver abstractions")
Acked-by: Alice Ryhl <aliceryhl@google.com>
Acked-by: Igor Korotin <igor.korotin.linux@gmail.com>
Link: https://patch.msgid.link/20260107103511.570525-2-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>

+2 -2
+2 -2
rust/kernel/i2c.rs
··· 181 // SAFETY: `shutdown_callback` is only ever called after a successful call to 182 // `probe_callback`, hence it's guaranteed that `Device::set_drvdata()` has been called 183 // and stored a `Pin<KBox<T>>`. 184 - let data = unsafe { idev.as_ref().drvdata_obtain::<T>() }; 185 186 - T::shutdown(idev, data.as_ref()); 187 } 188 189 /// The [`i2c::IdTable`] of the corresponding driver.
··· 181 // SAFETY: `shutdown_callback` is only ever called after a successful call to 182 // `probe_callback`, hence it's guaranteed that `Device::set_drvdata()` has been called 183 // and stored a `Pin<KBox<T>>`. 184 + let data = unsafe { idev.as_ref().drvdata_borrow::<T>() }; 185 186 + T::shutdown(idev, data); 187 } 188 189 /// The [`i2c::IdTable`] of the corresponding driver.