mtd/drivers/mtd mtd_blkdevs.c,1.4,1.5

David Woodhouse dwmw2 at infradead.org
Sun May 18 13:42:15 EDT 2003


Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv5875

Modified Files:
	mtd_blkdevs.c 
Log Message:
Don't allow open of absent partitions


Index: mtd_blkdevs.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- mtd_blkdevs.c	18 May 2003 17:30:09 -0000	1.4
+++ mtd_blkdevs.c	18 May 2003 17:42:12 -0000	1.5
@@ -178,6 +178,11 @@
 	if (!dev)
 		goto out;
 
+	if (!tr->blkcore_priv->part_table[minor_nr].nr_sects) {
+		ret = -ENODEV;
+		goto out;
+	}
+
 	if (!try_module_get(dev->mtd->owner))
 		goto out;
 
@@ -380,12 +385,6 @@
 	init_MUTEX(&new->sem);
 	list_add_tail(&new->list, &tr->devs);
  added:
-	printk("New blktrans device for %s added as device #%d\n",
-	       tr->name, new->devnum);
-	list_for_each(this, &tr->devs) {
-		struct mtd_blktrans_dev *d = list_entry(this, struct mtd_blktrans_dev, list);
-		printk("Dev # %d at %p\n", d->devnum, d);
-	}
 	new->usecount = 0;
 	tr->blkcore_priv->sizes[new->devnum << tr->part_bits] = new->size;
 	tr->blkcore_priv->gd.nr_real++;




More information about the linux-mtd-cvs mailing list