[MTD] map_rom has NULL erase pointer
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Sun Jan 11 14:59:01 EST 2009
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=5f877607cdfe8b60bf96fb96e527e0ce2a21e68b
Commit: 5f877607cdfe8b60bf96fb96e527e0ce2a21e68b
Parent: 57c1a24ee276a33190008243f986419e122c0dea
Author: Alan Cox <alan at redhat.com>
AuthorDate: Sun Jan 11 19:52:19 2009 +0000
Committer: David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Sun Jan 11 19:56:46 2009 +0000
[MTD] map_rom has NULL erase pointer
Which means if inftl or similar are loaded with it (which is a dumb thing
to do admittedly) it may oops.
Closes #8108
[dwmw2: change error to -EROFS to match write-protected flash]
Signed-off-by: Alan Cox <alan at redhat.com>
Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
drivers/mtd/chips/map_rom.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/drivers/mtd/chips/map_rom.c b/drivers/mtd/chips/map_rom.c
index 821d0ed..c76d6e5 100644
--- a/drivers/mtd/chips/map_rom.c
+++ b/drivers/mtd/chips/map_rom.c
@@ -19,6 +19,7 @@ static int maprom_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
static int maprom_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
static void maprom_nop (struct mtd_info *);
static struct mtd_info *map_rom_probe(struct map_info *map);
+static int maprom_erase (struct mtd_info *mtd, struct erase_info *info);
static struct mtd_chip_driver maprom_chipdrv = {
.probe = map_rom_probe,
@@ -42,6 +43,7 @@ static struct mtd_info *map_rom_probe(struct map_info *map)
mtd->read = maprom_read;
mtd->write = maprom_write;
mtd->sync = maprom_nop;
+ mtd->erase = maprom_erase;
mtd->flags = MTD_CAP_ROM;
mtd->erasesize = map->size;
mtd->writesize = 1;
@@ -71,6 +73,12 @@ static int maprom_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *re
return -EIO;
}
+static int maprom_erase (struct mtd_info *mtd, struct erase_info *info)
+{
+ /* We do our best 8) */
+ return -EROFS;
+}
+
static int __init map_rom_init(void)
{
register_mtd_chip_driver(&maprom_chipdrv);
More information about the linux-mtd-cvs
mailing list