<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/mtd/mtdpart.c, branch v6.12.80</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-01-08T09:14:42+00:00</updated>
<entry>
<title>mtd: mtdpart: ignore error -ENOENT from parsers on subpartitions</title>
<updated>2026-01-08T09:14:42+00:00</updated>
<author>
<name>Christian Marangi</name>
<email>ansuelsmth@gmail.com</email>
</author>
<published>2025-11-09T11:52:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=846ceb1a94460f7331e879c02ff2dd505435b51b'/>
<id>urn:sha1:846ceb1a94460f7331e879c02ff2dd505435b51b</id>
<content type='text'>
commit 64ef5f454e167bb66cf70104f033c3d71e6ef9c0 upstream.

Commit 5c2f7727d437 ("mtd: mtdpart: check for subpartitions parsing
result") introduced some kind of regression with parser on subpartitions
where if a parser emits an error then the entire parsing process from the
upper parser fails and partitions are deleted.

Not checking for error in subpartitions was originally intended as
special parser can emit error also in the case of the partition not
correctly init (for example a wiped partition) or special case where the
partition should be skipped due to some ENV variables externally
provided (from bootloader for example)

One example case is the TRX partition where, in the context of a wiped
partition, returns a -ENOENT as the trx_magic is not found in the
expected TRX header (as the partition is wiped)

To better handle this and still keep some kind of error tracking (for
example to catch -ENOMEM errors or -EINVAL errors), permit parser on
subpartition to emit -ENOENT error, print a debug log and skip them
accordingly.

This results in giving better tracking of the status of the parser
(instead of returning just 0, dropping any kind of signal that there is
something wrong with the parser) and to some degree restore the original
logic of the subpartitions parse.

(worth to notice that some special partition might have all the special
header present for the parser and declare 0 partition in it, this is why
it would be wrong to simply return 0 in the case of a special partition
that is NOT init for the scanning parser)

Cc: stable@vger.kernel.org
Fixes: 5c2f7727d437 ("mtd: mtdpart: check for subpartitions parsing result")
Signed-off-by: Christian Marangi &lt;ansuelsmth@gmail.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>mtd: mtdpart: check for subpartitions parsing result</title>
<updated>2023-10-16T08:50:32+00:00</updated>
<author>
<name>Rafał Miłecki</name>
<email>rafal@milecki.pl</email>
</author>
<published>2023-09-27T20:26:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5c2f7727d437cd42033d13ebc8b3d74b9fe65712'/>
<id>urn:sha1:5c2f7727d437cd42033d13ebc8b3d74b9fe65712</id>
<content type='text'>
parse_mtd_partitions() may return an error so it should be checked and
optionally passed up

Signed-off-by: Rafał Miłecki &lt;rafal@milecki.pl&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/20230927202657.27169-1-zajec5@gmail.com
</content>
</entry>
<entry>
<title>mtd: use refcount to prevent corruption</title>
<updated>2023-07-12T11:30:08+00:00</updated>
<author>
<name>Tomas Winkler</name>
<email>tomas.winkler@intel.com</email>
</author>
<published>2023-06-20T13:19:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=19bfa9ebebb5ec0695def57eb1d80de7e9cab369'/>
<id>urn:sha1:19bfa9ebebb5ec0695def57eb1d80de7e9cab369</id>
<content type='text'>
When underlying device is removed mtd core will crash
in case user space is holding open handle.
Need to use proper refcounting so device is release
only when has no users.

Signed-off-by: Tomas Winkler &lt;tomas.winkler@intel.com&gt;
Signed-off-by: Alexander Usyskin &lt;alexander.usyskin@intel.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/20230620131905.648089-2-alexander.usyskin@intel.com
</content>
</entry>
<entry>
<title>mtd: mtdpart: Drop useless LIST_HEAD</title>
<updated>2023-06-09T15:27:14+00:00</updated>
<author>
<name>Christophe JAILLET</name>
<email>christophe.jaillet@wanadoo.fr</email>
</author>
<published>2023-06-04T04:42:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6db02fdfdca0cf39b4d66950451d7f22b72a9031'/>
<id>urn:sha1:6db02fdfdca0cf39b4d66950451d7f22b72a9031</id>
<content type='text'>
'tmp_list' is unused, so drop it.

Signed-off-by: Christophe JAILLET &lt;christophe.jaillet@wanadoo.fr&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/547248195d87d1240d6126d13eb1364b1a0b634d.1685853690.git.christophe.jaillet@wanadoo.fr
</content>
</entry>
<entry>
<title>mtd: mtdpart: Don't create platform device that'll never probe</title>
<updated>2023-02-08T12:37:55+00:00</updated>
<author>
<name>Saravana Kannan</name>
<email>saravanak@google.com</email>
</author>
<published>2023-02-07T01:42:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fb42378dcc7f247df56f0ecddfdae85487495fbc'/>
<id>urn:sha1:fb42378dcc7f247df56f0ecddfdae85487495fbc</id>
<content type='text'>
These "nvmem-cells" platform devices never get probed because there's no
platform driver for it and it's never used anywhere else. So it's a
waste of memory. These devices also cause fw_devlink to block nvmem
consumers of "nvmem-cells" partition from probing because the supplier
device never probes.

So stop creating platform devices for nvmem-cells partitions to avoid
wasting memory and to avoid blocking probing of consumers.

Reported-by: Maxim Kiselev &lt;bigunclemax@gmail.com&gt;
Fixes: bcdf0315a61a ("mtd: call of_platform_populate() for MTD partitions")
Signed-off-by: Saravana Kannan &lt;saravanak@google.com&gt;
Tested-by: Maksim Kiselev &lt;bigunclemax@gmail.com&gt;
Tested-by: Douglas Anderson &lt;dianders@chromium.org&gt;
Tested-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Tested-by: Luca Weiss &lt;luca.weiss@fairphone.com&gt; # qcom/sm7225-fairphone-fp4
Link: https://lore.kernel.org/r/20230207014207.1678715-13-saravanak@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>mtd: call of_platform_populate() for MTD partitions</title>
<updated>2022-05-16T16:37:48+00:00</updated>
<author>
<name>Rafał Miłecki</name>
<email>rafal@milecki.pl</email>
</author>
<published>2022-05-10T13:12:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bcdf0315a61a29eb753a607d3a85a4032de72d94'/>
<id>urn:sha1:bcdf0315a61a29eb753a607d3a85a4032de72d94</id>
<content type='text'>
Until this change MTD subsystem supported handling partitions only with
MTD partitions parsers. That's a specific / limited API designed around
partitions.

Some MTD partitions may however require different handling. They may
contain specific data that needs to be parsed and somehow extracted. For
that purpose MTD subsystem should allow binding of standard platform
drivers.

An example can be U-Boot (sub)partition with environment variables.
There exist a "u-boot,env" DT binding for MTD (sub)partition that
requires an NVMEM driver.

Ref: 5db1c2dbc04c ("dt-bindings: nvmem: add U-Boot environment variables binding")
Signed-off-by: Rafał Miłecki &lt;rafal@milecki.pl&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/20220510131259.555-1-zajec5@gmail.com
</content>
</entry>
<entry>
<title>mtd: Fixed breaking list in __mtd_del_partition.</title>
<updated>2021-12-03T13:27:18+00:00</updated>
<author>
<name>Andreas Oetken</name>
<email>ennoerlangen@gmail.com</email>
</author>
<published>2021-11-02T17:26:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2966daf7d253d9904b337b040dd7a43472858b8a'/>
<id>urn:sha1:2966daf7d253d9904b337b040dd7a43472858b8a</id>
<content type='text'>
Not the child partition should be removed from the partition list
but the partition itself. Otherwise the partition list gets broken
and any subsequent remove operations leads to a kernel panic.

Fixes: 46b5889cc2c5 ("mtd: implement proper partition handling")
Signed-off-by: Andreas Oetken &lt;andreas.oetken@siemens-energy.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/20211102172604.2921065-1-andreas.oetken@siemens-energy.com
</content>
</entry>
<entry>
<title>mtd: mtdpart: use DEVICE_ATTR_RO() helper macro</title>
<updated>2021-06-11T18:42:45+00:00</updated>
<author>
<name>Zhen Lei</name>
<email>thunder.leizhen@huawei.com</email>
</author>
<published>2021-06-03T12:30:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=97f41002945fd9c55e8b80c654ea34fd434250e7'/>
<id>urn:sha1:97f41002945fd9c55e8b80c654ea34fd434250e7</id>
<content type='text'>
Use DEVICE_ATTR_RO() helper macro instead of plain DEVICE_ATTR(), which
makes the code a bit shorter and easier to read.

Signed-off-by: Zhen Lei &lt;thunder.leizhen@huawei.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/20210603123041.12036-1-thunder.leizhen@huawei.com
</content>
</entry>
<entry>
<title>mtd: mtdpart: Convert sysfs sprintf/snprintf family to sysfs_emit</title>
<updated>2021-05-10T08:44:43+00:00</updated>
<author>
<name>Tian Tao</name>
<email>tiantao6@hisilicon.com</email>
</author>
<published>2021-04-12T09:35:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ce675043fa12dfc50276e00f31da61e14846b178'/>
<id>urn:sha1:ce675043fa12dfc50276e00f31da61e14846b178</id>
<content type='text'>
Use sysfs_emit instead of snprintf to avoid buf overrun,because in
sysfs_emit it strictly checks whether buf is null or buf whether
pagesize aligned, otherwise it returns an error.

Signed-off-by: Tian Tao &lt;tiantao6@hisilicon.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/1618220144-33839-3-git-send-email-tiantao6@hisilicon.com
</content>
</entry>
<entry>
<title>mtd: don't lock when recursively deleting partitions</title>
<updated>2021-03-11T08:37:49+00:00</updated>
<author>
<name>David Bauer</name>
<email>mail@david-bauer.net</email>
</author>
<published>2021-02-17T19:53:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cb4543054c5c4fd33df960b41d7b483ebca8e786'/>
<id>urn:sha1:cb4543054c5c4fd33df960b41d7b483ebca8e786</id>
<content type='text'>
When recursively deleting partitions, don't acquire the masters
partition lock twice. Otherwise the process ends up in a deadlocked
state.

Fixes: 46b5889cc2c5 ("mtd: implement proper partition handling")
Signed-off-by: David Bauer &lt;mail@david-bauer.net&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/20210217195320.893253-1-mail@david-bauer.net
</content>
</entry>
</feed>
