* [PATCH] mtd: core: Fix refcounting for unpartitioned MTDs
@ 2020-12-06 20:22 Richard Weinberger
2020-12-07 11:15 ` Miquel Raynal
0 siblings, 1 reply; 2+ messages in thread
From: Richard Weinberger @ 2020-12-06 20:22 UTC (permalink / raw)
To: miquel.raynal
Cc: vigneshr, linux-mtd, linux-kernel, Richard Weinberger, stable
Apply changes to usecount also the the master partition.
Otherwise we have no refcounting at all if an MTD has no partitions.
Cc: stable@vger.kernel.org
Fixes: 46b5889cc2c5 ("mtd: implement proper partition handling")
Signed-off-by: Richard Weinberger <richard@nod.at>
---
drivers/mtd/mtdcore.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index e9e163ae9d86..b07cbb0661fb 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -993,6 +993,8 @@ int __get_mtd_device(struct mtd_info *mtd)
}
}
+ master->usecount++;
+
while (mtd->parent) {
mtd->usecount++;
mtd = mtd->parent;
@@ -1059,6 +1061,8 @@ void __put_mtd_device(struct mtd_info *mtd)
mtd = mtd->parent;
}
+ master->usecount--;
+
if (master->_put_device)
master->_put_device(master);
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mtd: core: Fix refcounting for unpartitioned MTDs
2020-12-06 20:22 [PATCH] mtd: core: Fix refcounting for unpartitioned MTDs Richard Weinberger
@ 2020-12-07 11:15 ` Miquel Raynal
0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2020-12-07 11:15 UTC (permalink / raw)
To: Richard Weinberger, miquel.raynal
Cc: linux-mtd, vigneshr, stable, linux-kernel
On Sun, 2020-12-06 at 20:22:20 UTC, Richard Weinberger wrote:
> Apply changes to usecount also the the master partition.
> Otherwise we have no refcounting at all if an MTD has no partitions.
>
> Cc: stable@vger.kernel.org
> Fixes: 46b5889cc2c5 ("mtd: implement proper partition handling")
> Signed-off-by: Richard Weinberger <richard@nod.at>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.
Miquel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-07 11:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-06 20:22 [PATCH] mtd: core: Fix refcounting for unpartitioned MTDs Richard Weinberger
2020-12-07 11:15 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).