[PATCH] 2.6.4: Fix NULL pointer dereference in blkmtd.c

From: Michel Marti
Date: Thu Mar 11 2004 - 03:33:26 EST


Hello all,

The blkmtd driver oopses in add_device(). The following trivial patch fixes
this.

Cheers,

- Michel


diff -urN linux-2.6.4/drivers/mtd/devices/blkmtd.c linux-2.6.4-mma/drivers/mtd/devices/blkmtd.c
--- linux-2.6.4/drivers/mtd/devices/blkmtd.c 2004-02-18 04:57:13.000000000 +0100
+++ linux-2.6.4-mma/drivers/mtd/devices/blkmtd.c 2004-03-11 09:02:45.000000000 +0100
@@ -664,12 +664,12 @@
}

memset(dev, 0, sizeof(struct blkmtd_dev));
+ dev->blkdev = bdev;
atomic_set(&(dev->blkdev->bd_inode->i_mapping->truncate_count), 0);
if(!readonly) {
init_MUTEX(&dev->wrbuf_mutex);
}

- dev->blkdev = bdev;
dev->mtd_info.size = dev->blkdev->bd_inode->i_size & PAGE_MASK;

/* Setup the MTD structure */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/