diff -uprN linux-2.6.22.14/arch/i386/kernel/traps.c linux-2.6.22.14-new/arch/i386/kernel/traps.c
--- linux-2.6.22.14/arch/i386/kernel/traps.c	2007-11-21 17:30:59.000000000 +0000
+++ linux-2.6.22.14-new/arch/i386/kernel/traps.c	2007-12-10 13:02:20.000000000 +0000
@@ -411,6 +411,7 @@ void die(const char * str, struct pt_reg
 #endif
 		if (nl)
 			printk("\n");
+		sysfs_printk_last_file();
 		if (notify_die(DIE_OOPS, str, regs, err,
 					current->thread.trap_no, SIGSEGV) !=
 				NOTIFY_STOP) {
diff -uprN linux-2.6.22.14/arch/x86_64/kernel/traps.c linux-2.6.22.14-new/arch/x86_64/kernel/traps.c
--- linux-2.6.22.14/arch/x86_64/kernel/traps.c	2007-11-21 17:30:59.000000000 +0000
+++ linux-2.6.22.14-new/arch/x86_64/kernel/traps.c	2007-12-10 13:03:22.000000000 +0000
@@ -516,6 +516,7 @@ void __kprobes __die(const char * str, s
 	printk("DEBUG_PAGEALLOC");
 #endif
 	printk("\n");
+	sysfs_printk_last_file();
 	notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV);
 	show_registers(regs);
 	/* Executive summary in case the oops scrolled away */
diff -uprN linux-2.6.22.14/fs/sysfs/file.c linux-2.6.22.14-new/fs/sysfs/file.c
--- linux-2.6.22.14/fs/sysfs/file.c	2007-11-21 17:30:59.000000000 +0000
+++ linux-2.6.22.14-new/fs/sysfs/file.c	2007-12-10 13:04:55.000000000 +0000
@@ -8,6 +8,7 @@
 #include <linux/namei.h>
 #include <linux/poll.h>
 #include <linux/list.h>
+#include <linux/limits.h>
 #include <asm/uaccess.h>
 #include <asm/semaphore.h>
 
@@ -15,6 +16,13 @@
 
 #define to_sattr(a) container_of(a,struct subsys_attribute, attr)
 
+/* used in crash dumps to help with debugging */
+static char last_sysfs_file[PATH_MAX];
+void sysfs_printk_last_file(void)
+{
+       printk(KERN_EMERG "last sysfs file: %s\n", last_sysfs_file);
+}
+
 /*
  * Subsystem file operations.
  * These operations allow subsystems to have files that can be 
@@ -253,6 +261,12 @@ static int sysfs_open_file(struct inode 
 	struct sysfs_buffer * buffer;
 	struct sysfs_ops * ops = NULL;
 	int error = 0;
+	char *p;
+
+	p = d_path(file->f_dentry, sysfs_mount, last_sysfs_file,
+		   sizeof(last_sysfs_file));
+	if (p)
+		memmove(last_sysfs_file, p, strlen(p) + 1);
 
 	if (!kobj || !attr)
 		goto Einval;
diff -uprN linux-2.6.22.14/include/linux/sysfs.h linux-2.6.22.14-new/include/linux/sysfs.h
--- linux-2.6.22.14/include/linux/sysfs.h	2007-11-21 17:30:59.000000000 +0000
+++ linux-2.6.22.14-new/include/linux/sysfs.h	2007-12-10 13:00:20.000000000 +0000
@@ -125,6 +125,7 @@ void sysfs_remove_file_from_group(struct
 		const struct attribute *attr, const char *group);
 
 void sysfs_notify(struct kobject * k, char *dir, char *attr);
+void sysfs_printk_last_file(void);
 
 
 extern int sysfs_make_shadowed_dir(struct kobject *kobj,
@@ -240,6 +241,11 @@ static inline int __must_check sysfs_ini
 	return 0;
 }
 
+static inline void sysfs_printk_last_file(void)
+{
+       ;
+}
+
 #endif /* CONFIG_SYSFS */
 
 #endif /* _SYSFS_H_ */
