[PATCH] mtd: use refcount to prevent corruption
Winkler, Tomas
tomas.winkler at intel.com
Wed Jan 27 15:55:46 EST 2021
> Subject: Re: [PATCH] mtd: use refcount to prevent corruption
>
> Tomas,
>
> ----- Ursprüngliche Mail -----
> > Von: "Tomas Winkler" <tomas.winkler at intel.com>
> > An: "Miquel Raynal" <miquel.raynal at bootlin.com>, "richard"
> > <richard at nod.at>, "Vignesh Raghavendra" <vigneshr at ti.com>, "linux-mtd"
> > <linux-mtd at lists.infradead.org>, "linux-kernel"
> > <linux-kernel at vger.kernel.org>
> > CC: "Tomas Winkler" <tomas.winkler at intel.com>
> > Gesendet: Mittwoch, 27. Januar 2021 21:03:19
> > Betreff: [PATCH] mtd: use refcount to prevent corruption
>
> > When underlying device is removed mtd core will crash in case user
> > space is still holding an open handle to a mtd device node.
> > A proper refcounting is needed so device is release only when a
> > partition has no active users. The current simple counter is not
> > sufficient.
>
> Can you please explain a little more what devices are involved?
> Does it implement _get_device() and _put_device()?
No this is not connected to those handlers of the underlying device and those won't help.
I have a spi device provided by MFD framework so it can go away anytime.
My solution tries to replace the current simple partition reference counting. In previous solution it will return -EBUSY on partition that is held but will remove the actual parent device, leading to crash.
Also w/o reference counting there is no process to actually remove the partition that was previously busy.
Thanks
Tomas
>
> Thanks,
> //richard
More information about the linux-mtd
mailing list