Re: [PATCH] mtd: mtdoops: free page bitmap when the backing MTD is removed

Miquel Raynal <[email protected]> Fri, 17 Jul 2026 17:50:44 +0200
Newsgroups gmane.linux.kernel.stable,gmane.linux.drivers.mtd,gmane.linux.kernel
Message-ID <[email protected]>
On Mon, 13 Jul 2026 13:22:03 +0800, raoxu wrote:
> mtdoops_notify_add() allocates oops_page_used when the configured MTD
> device is registered.  mtdoops_notify_remove() detaches from that device
> but leaves the bitmap allocated.  If the same MTD device is later
> registered again, the add path allocates a new bitmap and overwrites the
> old pointer, leaking one vmalloc allocation per remove/add cycle.
> 
> This is only visible when the backing MTD device can disappear and be
> registered again while mtdoops remains loaded, so the usual static MTD
> case does not expose it.
> 
> [...]

Applied to mtd/next, thanks!

[1/1] mtd: mtdoops: free page bitmap when the backing MTD is removed
      commit: 956e7da12c114f13c63d126ab1d79c3b6a819060

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