Oops ERROR : Unable to handle kernel NULL pointer dereference at virtual address 00000000

David Woodhouse dwmw2 at infradead.org
Sun May 25 05:44:15 EDT 2003


On Sat, 2003-05-24 at 22:20, kusdogan at boun.edu.tr wrote:
> Hi,
> 
> I patched my 2.4.18 kernel with latest MTD source. Now it crashes in in fucntion 
> add_mtd_device (mtdcore.c). 

> 
>                         DEBUG(0, "mtd: Giving out device %d to %s\n",i, mtd->nam$                   
>                        /* No need to get a refcount on the module containing
>                            the notifier, since we hold the mtd_table_mutex */
>                         list_for_each(this, &mtd_notifiers) {
>                                 struct mtd_notifier *not = list_entry(this, stru$                                
> 		    not->add(mtd);		<------------- CRASH
>                         }

Thanks for the report. Please could you apply this patch and check what
it prints...

Index: mtdcore.c
===================================================================
RCS file: /home/dwmw2/.mtd-cvs-backup/cvs/mtd/drivers/mtd/mtdcore.c,v
retrieving revision 1.39
diff -u -p -r1.39 mtdcore.c
--- mtdcore.c	21 May 2003 15:15:03 -0000	1.39
+++ mtdcore.c	25 May 2003 09:42:23 -0000
@@ -64,6 +64,7 @@ int add_mtd_device(struct mtd_info *mtd)
 			   the notifier, since we hold the mtd_table_mutex */
 			list_for_each(this, &mtd_notifiers) {
 				struct mtd_notifier *not = list_entry(this, struct mtd_notifier, list);
+				printk("Add %p for notifier at %p\n", not->add, not);
 				not->add(mtd);
 			}
 			
@@ -134,6 +135,11 @@ int del_mtd_device (struct mtd_info *mtd
 void register_mtd_user (struct mtd_notifier *new)
 {
 	int i;
+
+	if (!new->add) { 
+		printk("Notifier at %p has no ->add().\n", new);
+		BUG();
+	}
 
 	down(&mtd_table_mutex);
 



-- 
dwmw2




More information about the linux-mtd mailing list