[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ywza55o3baosjwncxicrhaxiyu45wyrosqlxbxqkzl77schchw@sxfqkmr44mz6>
Date: Fri, 24 Oct 2025 16:07:43 +0300
From: Ioana Ciornei <ioana.ciornei@....com>
To: Wentao Liang <vulab@...as.ac.cn>
Cc: linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH] bus: fsl-mc: fix device reference leak in
fsl_mc_device_lookup()
On Thu, Oct 23, 2025 at 11:05:58PM +0800, Wentao Liang wrote:
> The device_find_child() function calls the get_device() and returns a
> device reference that must be properly released when no longer needed.
The release should be done when no longer needed, not even before
returning the device to the caller.
> The fsl_mc_device_lookup() directly returns without releasing the
> reference via put_device().
>
> Add the missing put_device() call to prevent reference leaks.
>
No, the call to put_device should not be done from fsl_mc_device_lookup()
but instead from its callers when indeed the device is no longer in use.
For example, fsl_mc_obj_device_add() does call put_device().
Ioana
Powered by blists - more mailing lists