Re: [PATCH] mtd: mtdsuper: Fix MTD device reference leak in mtd_get_sb()
From: Miquel Raynal
Date: Fri Sep 25 2026 - 10:36:30 EST
On Thu, 17 Sep 2026 10:25:50 +0000, Wentao Liang wrote:
> mtd_get_sb() is called with a reference to the MTD device already
> taken by the caller. When sget_dev() fails, the function returns the
> error without dropping that reference, so the device is never released
> and its refcount never reaches zero. Every mount attempt on an MTD
> device whose superblock cannot be set up leaks a reference.
>
> Restore the put_mtd_device() that the fs_context conversion dropped on
> this path.
>
> [...]
Applied to mtd/next, thanks!
[1/1] mtd: mtdsuper: Fix MTD device reference leak in mtd_get_sb()
commit: 62ee3da38f41bef83c1cf250f6816a0ee187674b
Patche(s) should be available on mtd/linux.git and will be
part of the next PR (provided that no robot complains by then).
Kind regards,
Miquèl