[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e6703b6c-0ae5-450a-ae3a-1ad899c8f374@web.de>
Date: Sat, 27 Sep 2025 14:56:49 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: make24@...as.ac.cn, linux-i2c@...r.kernel.org,
Andi Shyti <andi.shyti@...nel.org>, Elie Morisse <syniurge@...il.com>,
Shyam Sundar S K <Shyam-sundar.S-k@....com>, Wolfram Sang <wsa@...nel.org>
Cc: stable@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] i2c: fix reference leak in MP2 PCI device
> In i2c_amd_probe(), amd_mp2_find_device() utilizes
> driver_find_next_device() which internally calls driver_find_device()
> to locate the matching device. driver_find_device() increments the
> reference count of the found device by calling get_device(), but
> amd_mp2_find_device() fails to call put_device() to decrement the
> reference count before returning. This results in a reference count
> leak of the PCI device each time i2c_amd_probe() is executed, which
> may prevent the device from being properly released and cause a memory
> leak.
How do you think about to increase the application of scope-based resource management?
https://elixir.bootlin.com/linux/v6.17-rc7/source/include/linux/device.h#L1180
Regards,
Markus
Powered by blists - more mailing lists