[PATCH v3 04/58] mtd: retain virtual concatenations across component removal

sashiko-bot at kernel.org sashiko-bot at kernel.org
Wed Nov 11 19:09:04 PST 2026


Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mtd: mtdconcat: mtd_concat_create() checks subdev ooblayout
  instead of master
--

commit 34bd63d3c8b343ca3ff6e172ada709306e4291bd
Author: James Hilliard <james.hilliard1 at gmail.com>

mtd: retain virtual concatenations across component removal

This commit reworks virtual MTD concatenation lifetime management, using
reference counting for staged partition components and SRCU to synchronize
forwarding operations during disconnect and teardown.

Link: https://lore.kernel.org/r/20261103143953.69642-1-izaiahsun@gmail.com/
Link: https://lore.kernel.org/r/sashiko-outbox-195551@kernel.org/

> diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c
> index c97167d51fe2d..cce3e2fcafc84 100644
> --- a/drivers/mtd/mtdconcat.c
> +++ b/drivers/mtd/mtdconcat.c
[ ... ]
> @@ -738,7 +822,8 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[],	/* subdevices to c
>  
>  	}
>  
> -	mtd_set_ooblayout(&concat->mtd, subdev[0]->ooblayout);
> +	if (subdev[0]->ooblayout)
> +		mtd_set_ooblayout(&concat->mtd, &concat_ooblayout_ops);

[Severity: Medium]
Should this check mtd_get_master(subdev[0])->ooblayout instead of
subdev[0]->ooblayout?

allocate_partition() does not copy ooblayout onto child partition mtd_info
structs; mtd_ooblayout_ecc() and mtd_ooblayout_free() look it up on
mtd_get_master(mtd).  When mtd_concat_create() is called with partition
subdevices (as mtd_virt_concat_register() always does), subdev[0]->ooblayout
is NULL, so concat_ooblayout_ops is never installed and OOB layout queries on
the concatenated device fail with -ENOTSUPP.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261111-submit-rawnand-retained-handle-lifetime-v1-v3-0-ce537999741d@gmail.com?part=4



More information about the linux-mtd mailing list