Re: [PATCH] mtd: fix double free and WARN_ON in add_mtd_device() error paths

Miquel Raynal <[email protected]>
Newsgroups org.infradead.lists.linux-mtd,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Wed, 01 Jul 2026 20:10:42 +0800, Xue Lei wrote:
> When device_register() or mtd_nvmem_add() fails inside
> add_mtd_device() for a partition, the error handling triggers
> mtd_release() via put_device() or device_unregister(). mtd_release()
> calls release_mtd_partition() which frees the mtd_info structure.
> However, callers such as mtd_add_partition() and add_mtd_partitions()
> also call free_partition() in their error paths, resulting in a double
> free.
> 
> [...]

Applied to mtd/fixes, thanks!

[1/1] mtd: fix double free and WARN_ON in add_mtd_device() error paths
      commit: 9d4af746af8ce27eefc2338b2feaa1e01f28b6c3

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


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.