milos-linux/rust/kernel
Nicolás Antinori 4eb422482c rust: i2c: fix I2cAdapter refcounts double increment
When `I2cAdapter::get` executes, it first calls
`bindings::i2c_get_adapter()` which increments the device and module
reference counts. It then takes a reference to the raw pointer and
converts it to an `ARef` via `.into()`.

The implementation of `From<&T> for ARef<T>` where `T: AlwaysRefCounted`
unconditionally calls `T::inc_ref()`. This leads to a second increment
to the reference counts.

Since the returned `ARef` will only release a single reference when
dropped via `dec_ref()`, this leaks one device and module reference count
on every call.

This fix was suggested by sashiko.dev.

Link: https://sashiko.dev/#/patchset/20260521190937.248904-1-nico.antinori.7@gmail.com
Signed-off-by: Nicolás Antinori <nico.antinori.7@gmail.com>
Reviewed-by: Igor Korotin <igor.korotin@linux.dev>
Signed-off-by: Igor Korotin <igor.korotin@linux.dev>
2026-06-06 15:19:27 +01:00
..
alloc Char/Misc/IIO/and others driver updates for 7.1-rc1 2026-04-24 13:23:50 -07:00
block rust: block: update const_refs_to_static MSRV TODO comment 2026-04-07 10:00:24 +02:00
debugfs Driver core changes for 7.0-rc1 2026-02-11 17:43:59 -08:00
device
drm rust: drm: fix unsound initialization in drm::Device::new 2026-05-03 14:04:57 +02:00
fs
gpu rust: gpu: Add GPU buddy allocator bindings 2026-03-23 21:41:47 +01:00
interop rust: interop: Add list module for C linked list interface 2026-03-23 20:29:28 +01:00
io rust: io: introduce write_reg and LocatedRegister 2026-03-17 20:04:11 +01:00
iommu rust: iommu: fix srctree link warning 2026-01-22 09:19:30 +01:00
irq rust: irq: move 'static bounds to traits 2026-03-03 20:33:26 +01:00
list Locking updates for v7.1: 2026-04-14 12:36:25 -07:00
mm mm: rename zap_page_range_single() to zap_vma_range() 2026-04-05 13:53:15 -07:00
net
num Driver core changes for 7.1-rc1 2026-04-13 19:03:11 -07:00
pci rust: pci: io: remove overloaded Io methods of ConfigSpace 2026-03-17 20:02:09 +01:00
ptr rust: ptr: add projection infrastructure 2026-03-07 23:06:17 +01:00
str
sync Char/Misc/IIO/and others driver updates for 7.1-rc1 2026-04-24 13:23:50 -07:00
time hrtimer: add usage examples to documentation 2026-03-23 08:31:00 +01:00
.gitignore
acpi.rs
alloc.rs
auxiliary.rs Linux 6.19-rc7 2026-01-26 13:23:52 +01:00
bitmap.rs
bits.rs
block.rs
bug.rs rust: bug: Support DEBUG_BUGVERBOSE_DETAILED option 2026-01-30 05:18:17 +01:00
build_assert.rs rust: rework build_assert! documentation 2026-03-30 02:03:52 +02:00
clk.rs rust: clk: implement Send and Sync 2026-04-03 11:57:35 +02:00
configfs.rs
cpu.rs
cpufreq.rs cpufreq: Pass the policy to cpufreq_driver->adjust_perf() 2026-04-02 11:30:24 -05:00
cpumask.rs rust: cpumask: rename methods of Cpumask for clarity and consistency 2026-01-27 11:21:23 +05:30
cred.rs
debugfs.rs
device.rs rust: device: add device name method 2026-03-24 23:51:23 +01:00
device_id.rs
devres.rs rust: devres: embed struct devres_node directly 2026-03-18 00:47:14 +01:00
dma.rs rust: dma: add from-slice constructors for Coherent and CoherentBox 2026-03-28 22:20:07 +09:00
driver.rs Linux 6.19-rc7 2026-01-26 13:23:52 +01:00
error.rs drm for v7.1-rc1 2026-04-15 08:45:00 -07:00
faux.rs
firmware.rs
fmt.rs
fs.rs
generated_arch_reachable_asm.rs.S
generated_arch_static_branch_asm.rs.S
generated_arch_warn_asm.rs.S
gpu.rs rust: gpu: Add GPU buddy allocator bindings 2026-03-23 21:41:47 +01:00
i2c.rs rust: i2c: fix I2cAdapter refcounts double increment 2026-06-06 15:19:27 +01:00
id_pool.rs
impl_flags.rs rust: add impl_flags! macro for defining common bitflag operations 2026-02-02 08:09:11 +01:00
init.rs
interop.rs rust: interop: Add list module for C linked list interface 2026-03-23 20:29:28 +01:00
io.rs rust: io: introduce write_reg and LocatedRegister 2026-03-17 20:04:11 +01:00
ioctl.rs
iov.rs
irq.rs
jump_label.rs
kunit.rs rust: kunit: fix warning when !CONFIG_PRINTK 2026-03-02 10:01:15 -07:00
lib.rs drm for v7.1-rc1 2026-04-15 08:45:00 -07:00
list.rs rust: list: hide macros from top-level kernel doc 2026-03-27 12:15:47 +01:00
maple_tree.rs
miscdevice.rs
mm.rs
module_param.rs
net.rs
num.rs
of.rs
opp.rs
page.rs
pci.rs rust: pci: re-export ConfigSpace 2026-02-01 22:18:24 +01:00
pid_namespace.rs
platform.rs Linux 6.19-rc7 2026-01-26 13:23:52 +01:00
prelude.rs rust: remove RUSTC_HAS_SLICE_AS_FLATTENED and simplify code 2026-04-07 10:00:23 +02:00
print.rs rust: print: Add pr_*_once macros 2026-01-30 05:47:05 +01:00
processor.rs
ptr.rs Rust timekeeping changes for v7.1 2026-04-08 10:44:11 +02:00
pwm.rs rust: pwm: Simplify to_result call sites and unsafe blocks 2026-01-20 18:49:58 +01:00
rbtree.rs Rust changes for v6.20 / v7.0 2026-02-10 11:53:01 -08:00
regulator.rs rust: regulator: do not assume that regulator_get() returns non-null 2026-03-24 13:08:21 +00:00
revocable.rs
safety.rs rust: safety: introduce unsafe_precondition_assert! macro 2026-02-02 08:10:48 +01:00
scatterlist.rs
security.rs
seq_file.rs rust: seq_file: replace kernel::c_str! with C-Strings 2026-01-29 15:32:40 +01:00
sizes.rs rust: sizes: add SizeConstants trait for device address space constants 2026-04-07 12:57:50 +02:00
soc.rs
std_vendor.rs
str.rs Rust timekeeping changes for v7.1 2026-04-08 10:44:11 +02:00
sync.rs rust: sync: Replace kernel::c_str! with C-Strings 2026-01-28 09:25:44 +01:00
task.rs Char/Misc/IIO/and others driver updates for 7.1-rc1 2026-04-24 13:23:50 -07:00
time.rs rust: time: make ClockSource unsafe trait 2026-03-23 08:29:48 +01:00
tracepoint.rs
transmute.rs rust: transmute: simplify code with Rust 1.80.0 split_at_*checked() 2026-04-07 10:00:24 +02:00
types.rs rust: types: remove temporary re-exports of ARef and AlwaysRefCounted 2026-03-15 20:30:29 +01:00
uaccess.rs Char/Misc/IIO/and others driver updates for 7.1-rc1 2026-04-24 13:23:50 -07:00
usb.rs rust: usb: Update AlwaysRefCounted imports to use sync::aref 2026-03-15 20:30:29 +01:00
workqueue.rs rust: workqueue: use new sync::aref path for imports 2026-03-26 15:45:34 +00:00
xarray.rs rust: kernel: mark as #[inline] all From::from()s for Error 2026-03-27 12:49:00 +01:00