* [PATCH] mtd: Make sure mtd->erasesize is valid even if the partition is of size 0
@ 2019-01-30 11:55 ` Boris Brezillon
0 siblings, 0 replies; 6+ messages in thread
From: Boris Brezillon @ 2019-01-30 11:55 UTC (permalink / raw)
To: David Woodhouse, Brian Norris, Boris Brezillon, Marek Vasut,
Richard Weinberger, Miquel Raynal, linux-mtd
Cc: stable, Geert Uytterhoeven
Commit 33f45c44d68b ("mtd: Do not allow MTD devices with inconsistent
erase properties") introduced a check to make sure ->erasesize and
->_erase values are consistent with the MTD_NO_ERASE flag.
This patch did not take the 0 bytes partition case into account which
can happen when the defined partition is outside the flash device memory
range. Fix that by setting the partition erasesize to the parent
erasesize.
Fixes: 33f45c44d68b ("mtd: Do not allow MTD devices with inconsistent erase properties")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: <stable@vger.kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Boris Brezillon <bbrezillon@kernel.org>
---
drivers/mtd/mtdpart.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index e6d9467f6be0..37f174ccbcec 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -480,6 +480,10 @@ static struct mtd_part *allocate_partition(struct mtd_info *parent,
/* let's register it anyway to preserve ordering */
slave->offset = 0;
slave->mtd.size = 0;
+
+ /* Initialize ->erasesize to make add_mtd_device() happy. */
+ slave->mtd.erasesize = parent->erasesize;
+
printk(KERN_ERR"mtd: partition \"%s\" is out of reach -- disabled\n",
part->name);
goto out_register;
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] mtd: Make sure mtd->erasesize is valid even if the partition is of size 0
@ 2019-01-30 11:55 ` Boris Brezillon
0 siblings, 0 replies; 6+ messages in thread
From: Boris Brezillon @ 2019-01-30 11:55 UTC (permalink / raw)
To: David Woodhouse, Brian Norris, Boris Brezillon, Marek Vasut,
Richard Weinberger, Miquel Raynal, linux-mtd
Cc: Geert Uytterhoeven, stable
Commit 33f45c44d68b ("mtd: Do not allow MTD devices with inconsistent
erase properties") introduced a check to make sure ->erasesize and
->_erase values are consistent with the MTD_NO_ERASE flag.
This patch did not take the 0 bytes partition case into account which
can happen when the defined partition is outside the flash device memory
range. Fix that by setting the partition erasesize to the parent
erasesize.
Fixes: 33f45c44d68b ("mtd: Do not allow MTD devices with inconsistent erase properties")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: <stable@vger.kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Boris Brezillon <bbrezillon@kernel.org>
---
drivers/mtd/mtdpart.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index e6d9467f6be0..37f174ccbcec 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -480,6 +480,10 @@ static struct mtd_part *allocate_partition(struct mtd_info *parent,
/* let's register it anyway to preserve ordering */
slave->offset = 0;
slave->mtd.size = 0;
+
+ /* Initialize ->erasesize to make add_mtd_device() happy. */
+ slave->mtd.erasesize = parent->erasesize;
+
printk(KERN_ERR"mtd: partition \"%s\" is out of reach -- disabled\n",
part->name);
goto out_register;
--
2.17.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] mtd: Make sure mtd->erasesize is valid even if the partition is of size 0
2019-01-30 11:55 ` Boris Brezillon
@ 2019-02-05 12:58 ` Geert Uytterhoeven
-1 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2019-02-05 12:58 UTC (permalink / raw)
To: Boris Brezillon
Cc: David Woodhouse, Brian Norris, Marek Vasut, Richard Weinberger,
Miquel Raynal, MTD Maling List, stable
Hi Boris,
On Wed, Jan 30, 2019 at 12:56 PM Boris Brezillon <bbrezillon@kernel.org> wrote:
> Commit 33f45c44d68b ("mtd: Do not allow MTD devices with inconsistent
> erase properties") introduced a check to make sure ->erasesize and
> ->_erase values are consistent with the MTD_NO_ERASE flag.
> This patch did not take the 0 bytes partition case into account which
> can happen when the defined partition is outside the flash device memory
> range. Fix that by setting the partition erasesize to the parent
> erasesize.
>
> Fixes: 33f45c44d68b ("mtd: Do not allow MTD devices with inconsistent erase properties")
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: <stable@vger.kernel.org>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Boris Brezillon <bbrezillon@kernel.org>
Thanks, that made the warning disappear.
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mtd: Make sure mtd->erasesize is valid even if the partition is of size 0
@ 2019-02-05 12:58 ` Geert Uytterhoeven
0 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2019-02-05 12:58 UTC (permalink / raw)
To: Boris Brezillon
Cc: Richard Weinberger, stable, Marek Vasut, MTD Maling List,
Miquel Raynal, Brian Norris, David Woodhouse
Hi Boris,
On Wed, Jan 30, 2019 at 12:56 PM Boris Brezillon <bbrezillon@kernel.org> wrote:
> Commit 33f45c44d68b ("mtd: Do not allow MTD devices with inconsistent
> erase properties") introduced a check to make sure ->erasesize and
> ->_erase values are consistent with the MTD_NO_ERASE flag.
> This patch did not take the 0 bytes partition case into account which
> can happen when the defined partition is outside the flash device memory
> range. Fix that by setting the partition erasesize to the parent
> erasesize.
>
> Fixes: 33f45c44d68b ("mtd: Do not allow MTD devices with inconsistent erase properties")
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: <stable@vger.kernel.org>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Boris Brezillon <bbrezillon@kernel.org>
Thanks, that made the warning disappear.
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: mtd: Make sure mtd->erasesize is valid even if the partition is of size 0
2019-01-30 11:55 ` Boris Brezillon
@ 2019-02-06 8:37 ` Boris Brezillon
-1 siblings, 0 replies; 6+ messages in thread
From: Boris Brezillon @ 2019-02-06 8:37 UTC (permalink / raw)
To: Boris Brezillon, David Woodhouse, Brian Norris, Marek Vasut,
Richard Weinberger, Miquel Raynal, linux-mtd
Cc: Your Name, Geert Uytterhoeven, stable
From: Your Name <patch-notifications@your-domain.com>
On Wed, 2019-01-30 at 11:55:52 UTC, Boris Brezillon wrote:
> Commit 33f45c44d68b ("mtd: Do not allow MTD devices with inconsistent
> erase properties") introduced a check to make sure ->erasesize and
> ->_erase values are consistent with the MTD_NO_ERASE flag.
> This patch did not take the 0 bytes partition case into account which
> can happen when the defined partition is outside the flash device memory
> range. Fix that by setting the partition erasesize to the parent
> erasesize.
>
> Fixes: 33f45c44d68b ("mtd: Do not allow MTD devices with inconsistent erase properties")
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: <stable@vger.kernel.org>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Boris Brezillon <bbrezillon@kernel.org>
> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Applied to http://git.infradead.org/linux-mtd.git mtd/fixes, thanks.
y'all come back now!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: mtd: Make sure mtd->erasesize is valid even if the partition is of size 0
@ 2019-02-06 8:37 ` Boris Brezillon
0 siblings, 0 replies; 6+ messages in thread
From: Boris Brezillon @ 2019-02-06 8:37 UTC (permalink / raw)
To: Boris Brezillon, David Woodhouse, Brian Norris, Marek Vasut,
Richard Weinberger, Miquel Raynal, linux-mtd
Cc: Geert Uytterhoeven, Your Name, stable
From: Your Name <patch-notifications@your-domain.com>
On Wed, 2019-01-30 at 11:55:52 UTC, Boris Brezillon wrote:
> Commit 33f45c44d68b ("mtd: Do not allow MTD devices with inconsistent
> erase properties") introduced a check to make sure ->erasesize and
> ->_erase values are consistent with the MTD_NO_ERASE flag.
> This patch did not take the 0 bytes partition case into account which
> can happen when the defined partition is outside the flash device memory
> range. Fix that by setting the partition erasesize to the parent
> erasesize.
>
> Fixes: 33f45c44d68b ("mtd: Do not allow MTD devices with inconsistent erase properties")
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: <stable@vger.kernel.org>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Boris Brezillon <bbrezillon@kernel.org>
> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Applied to http://git.infradead.org/linux-mtd.git mtd/fixes, thanks.
y'all come back now!
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-02-06 8:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-30 11:55 [PATCH] mtd: Make sure mtd->erasesize is valid even if the partition is of size 0 Boris Brezillon
2019-01-30 11:55 ` Boris Brezillon
2019-02-05 12:58 ` Geert Uytterhoeven
2019-02-05 12:58 ` Geert Uytterhoeven
2019-02-06 8:37 ` Boris Brezillon
2019-02-06 8:37 ` Boris Brezillon
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.