[PATCH 2/2] mtd: call external _get and _put in right order

Miquel Raynal miquel.raynal at bootlin.com
Wed Jul 12 07:13:45 PDT 2023


On Tue, 2023-06-20 at 13:19:05 UTC, Alexander Usyskin wrote:
> MTD provider provides mtd_info object to mtd subsystem.
> With kref patch the mtd_info object can be alive after
> provider released mtd device.
> Fix calling order in _get and _put functions to allow
> mtd provider to safely alloc and release mtd object.
> 
> Execute:
> 1) call external _get
> 2) get_module
> 3) add internal kref
> in the get function and opposite order in the put one.
> 
> The _put_device callback should be the last in put
> as the master struct memory may be freed in this callback.
> 
> Signed-off-by: Alexander Usyskin <alexander.usyskin at intel.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel



More information about the linux-mtd mailing list