linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] mtd: block2mtd: char mtd major check
@ 2014-01-23 19:49 Fabian Frederick
  2014-01-24 22:10 ` Ezequiel Garcia
  0 siblings, 1 reply; 3+ messages in thread
From: Fabian Frederick @ 2014-01-23 19:49 UTC (permalink / raw)
  To: linux-mtd; +Cc: akpm, rdunlap, joern, linux-kernel, ezequiel.garcia

Deny use of a char mtd device to map as a block device.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 drivers/mtd/devices/block2mtd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c
index d9fd87a..0efee5b 100644
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -244,7 +244,8 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size)
 	}
 	dev->blkdev = bdev;
 
-	if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
+	if ((MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) ||
+	    (MAJOR(bdev->bd_dev) == MTD_CHAR_MAJOR)) {
 		pr_err("attempting to use an MTD device as a block device\n");
 		goto devinit_err;
 	}
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-25 10:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-23 19:49 [PATCH 1/4] mtd: block2mtd: char mtd major check Fabian Frederick
2014-01-24 22:10 ` Ezequiel Garcia
2014-01-25  2:53   ` Fabian Frederick

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).