From: Andreas Oetken Date: Tue, 2 Nov 2021 17:26:04 +0000 (+0100) Subject: mtd: Fixed breaking list in __mtd_del_partition. X-Git-Tag: block-5.17-2022-01-21~70^2~13 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=2966daf7d253d9904b337b040dd7a43472858b8a;p=linux-block.git mtd: Fixed breaking list in __mtd_del_partition. 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 Cc: stable@vger.kernel.org Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20211102172604.2921065-1-andreas.oetken@siemens-energy.com --- diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 04af12b66110..357661b62c94 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -312,7 +312,7 @@ static int __mtd_del_partition(struct mtd_info *mtd) if (err) return err; - list_del(&child->part.node); + list_del(&mtd->part.node); free_partition(mtd); return 0;